Skip to content

Commit

Permalink
PTRENG-6002 - Fix docker image and docker repo name regex
Browse files Browse the repository at this point in the history
  • Loading branch information
benharosh committed Apr 19, 2024
1 parent 83f92ca commit 82312bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All changes to the log analytics integration will be documented in this file.

## [1.0.5] - April 18, 2024

* Fix fluentd regex to fetch correctly docker image and repo names

## [1.0.4] - April 09, 2024

* Fix access log regex pattern to match log structure
Expand Down
8 changes: 4 additions & 4 deletions fluent_metrics.conf.rt
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,10 @@
enable_ruby true
<record>
user ${!record["username"].strip().start_with?("token") ? (record["username"].strip()) : ("")}
repo ${record["request_url"].include?("/api/docker") && !record["request_url"].include?("/api/docker/null") && !record["request_url"].include?("/api/docker/v2") ? (record["request_url"].split('/')[3]) : ("")}
artifact ${record["request_url"].include?("/api/docker") && !record["request_url"].include?("/api/docker/null") && !record["request_url"].include?("/api/docker/v2") ? (record["request_url"].split('/')[5]) : ("")}
docker_repo ${record["request_url"].strip().include?("/api/docker") && !record["request_url"].include?("/api/docker/null") && !record["request_url"].include?("/api/docker/v2") ? (record["request_url"].strip().split('/')[3]) : ("")}
docker_image ${record["request_url"].strip().include?("/api/docker") && !record["request_url"].include?("/api/docker/null") && !record["request_url"].include?("/api/docker/v2") ? (record["request_url"].strip().split('/')[5]) : ("")}
repo ${record["request_url"].strip().include?("/api/docker") && !record["request_url"].include?("/api/docker/null") && !record["request_url"].include?("/api/docker/v2") && !record["request_url"].include?("v2/token") ? (record["request_url"].strip())[/api\/docker\/(.+)\/(?:v2)/, 1] : ("")}
artifact ${record["request_url"].strip().include?("/api/docker") && !record["request_url"].include?("/api/docker/null") && !record["request_url"].include?("/api/docker/v2") && !record["request_url"].include?("v2/token") ? (record["request_url"].strip())[/v2\/(.+)\/(?:manifests|blobs)/, 1] : ("")}
docker_repo ${record["request_url"].strip().include?("/api/docker") && !record["request_url"].include?("/api/docker/null") && !record["request_url"].include?("/api/docker/v2") && !record["request_url"].include?("v2/token") ? (record["request_url"].strip())[/api\/docker\/(.+)\/(?:v2)/, 1] : ("")}
docker_image ${record["request_url"].strip().include?("/api/docker") && !record["request_url"].include?("/api/docker/null") && !record["request_url"].include?("/api/docker/v2") && !record["request_url"].include?("v2/token") ? (record["request_url"].strip())[/v2\/(.+)\/(?:manifests|blobs)/, 1] : ("")}
data_download ${record["response_content_length"] == -1 ? 0 : record["response_content_length"]}
data_upload ${record["request_content_length"] == -1 ? 0 : record["request_content_length"]}
</record>
Expand Down

0 comments on commit 82312bb

Please sign in to comment.