Skip to content

Commit

Permalink
fix: Allow setting the service from the log group tags (#686)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebryant authored Sep 11, 2023
1 parent 5711bf9 commit 41a2694
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions aws/logs_monitoring/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,6 @@ def awslogs_handler(event, context, metadata):
source = "transitgateway"
metadata[DD_SOURCE] = parse_event_source(event, source)

metadata[DD_SERVICE] = get_service_from_tags(metadata)

# Build aws attributes
aws_attributes = {
"aws": {
Expand All @@ -516,6 +514,9 @@ def awslogs_handler(event, context, metadata):
else metadata[DD_CUSTOM_TAGS] + "," + ",".join(formatted_tags)
)

# Set service from custom tags, which may include the tags set on the log group
metadata[DD_SERVICE] = get_service_from_tags(metadata)

# Set host as log group where cloudwatch is source
if metadata[DD_SOURCE] == "cloudwatch" or metadata.get(DD_HOST, None) == None:
metadata[DD_HOST] = aws_attributes["aws"]["awslogs"]["logGroup"]
Expand Down

0 comments on commit 41a2694

Please sign in to comment.