Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion aws/logs_monitoring/enhanced_lambda_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ def parse_lambda_tags_from_arn(arn):
return [
"region:{}".format(region),
"account_id:{}".format(account_id),
# Include the aws_account tag to match the aws.lambda CloudWatch metrics
"aws_account:{}".format(account_id),
"functionname:{}".format(function_name),
]

Expand Down Expand Up @@ -435,5 +437,4 @@ def get_enriched_lambda_log_tags(log):
lambda_custom_tags = account_lambda_tags_cache.get(log_function_arn)
# Combine and dedup tags
tags = list(set(tags_from_arn + lambda_custom_tags))
tags.sort()
return tags
6 changes: 5 additions & 1 deletion aws/logs_monitoring/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,11 @@ def enrich(events):


def add_metadata_to_lambda_log(event):
"""Mutate log dict to add functionname tag, host, and service from the existing Lambda attribute
"""Mutate log dict to add tags, host, and service metadata

* tags for functionname, aws_account, region
* host from the Lambda ARN
* service from the Lambda name

If the event arg is not a Lambda log then this returns without doing anything

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"invoked_function_arn": "arn:aws:lambda:us-east-1:0:function:test"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0",
"ddsource": "cloudwatch",
"service": "cloudwatch",
"host": "testLogGroup"
Expand All @@ -38,7 +38,7 @@
"invoked_function_arn": "arn:aws:lambda:us-east-1:0:function:test"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0",
"ddsource": "cloudwatch",
"service": "cloudwatch",
"host": "testLogGroup"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -44,7 +44,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -66,7 +66,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -88,7 +88,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -110,7 +110,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -132,7 +132,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -154,7 +154,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -176,7 +176,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -198,7 +198,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -220,7 +220,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -242,7 +242,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -264,7 +264,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -286,7 +286,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -308,7 +308,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -330,7 +330,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand All @@ -352,7 +352,7 @@
"arn": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
},
"ddsourcecategory": "aws",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0,env:none,account_id:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.3.0,env:none,account_id:0,aws_account:0,functionname:hello-dog-node-dev-hello12x,region:us-east-1",
"ddsource": "lambda",
"service": "hello-dog-node-dev-hello12x",
"host": "arn:aws:lambda:us-east-1:0:function:hello-dog-node-dev-hello12x"
Expand Down