Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AWSMC-588] Support Bedrock log source #708

Merged
merged 5 commits into from
Nov 16, 2023
Merged
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
7 changes: 6 additions & 1 deletion aws/logs_monitoring/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ def find_cloudwatch_source(log_group):
"elasticsearch",
"transitgateway",
"verified-access",
"bedrock",
]:
if source in log_group:
return source
Expand Down Expand Up @@ -381,6 +382,7 @@ def find_s3_source(key):
"network-firewall",
"cloudfront",
"verified-access",
"bedrock",
]:
if source in key:
return source.replace("amazon_", "")
Expand Down Expand Up @@ -487,12 +489,14 @@ def awslogs_handler(event, context, metadata):
# Set the source on the logs
source = logs.get("logGroup", "cloudwatch")

# Use the logStream to identify if this is a CloudTrail event
# Use the logStream to identify if this is a CloudTrail, TransitGateway, or Bedrock event
# i.e. 123456779121_CloudTrail_us-east-1
if "_CloudTrail_" in logs["logStream"]:
source = "cloudtrail"
if "tgw-attach" in logs["logStream"]:
source = "transitgateway"
if logs["logStream"] == "aws/bedrock/modelinvocations":
source = "bedrock"
metadata[DD_SOURCE] = parse_event_source(event, source)

# Build aws attributes
Expand All @@ -515,6 +519,7 @@ def awslogs_handler(event, context, metadata):
)

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

# Set host as log group where cloudwatch is source
Expand Down