Skip to content

Commit

Permalink
Add handling for transit-gateway flow logs from cloudwatch + s3 logs (#…
Browse files Browse the repository at this point in the history
…585)

* Add transit gateway cloudwatch logs handling

* Add s3 bucket tg log parsing

* Remove log

* Change bucket key to transit-gateway
  • Loading branch information
sabiurr authored Jul 12, 2022
1 parent 11d1c77 commit d9442e6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aws/logs_monitoring/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ def s3_handler(event, context, metadata):
key = urllib.parse.unquote_plus(event["Records"][0]["s3"]["object"]["key"])

source = parse_event_source(event, key)
if "transit-gateway" in bucket:
source = "transitgateway"
metadata[DD_SOURCE] = source

metadata[DD_SERVICE] = get_service_from_tags(metadata)
Expand Down Expand Up @@ -313,6 +315,7 @@ def find_cloudwatch_source(log_group):
"cloudtrail",
"msk",
"elasticsearch",
"transitgateway",
]:
if source in log_group:
return source
Expand Down Expand Up @@ -461,6 +464,8 @@ def awslogs_handler(event, context, metadata):
# i.e. 123456779121_CloudTrail_us-east-1
if "_CloudTrail_" in logs["logStream"]:
source = "cloudtrail"
if "tgw-attach" in logs["logStream"]:
source = "transitgateway"
metadata[DD_SOURCE] = parse_event_source(event, source)

metadata[DD_SERVICE] = get_service_from_tags(metadata)
Expand Down

0 comments on commit d9442e6

Please sign in to comment.