Skip to content

Commit 230bc4f

Browse files
committed
Fix Cloudwatch Event logic, only capture for lambda@edge
1 parent 736c394 commit 230bc4f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

aws/logs_monitoring/lambda_function.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,10 +1044,12 @@ def cwevent_handler(event, metadata):
10441044
# detail.requestParameters.logGroupName
10451045
# detail.eventName == CreateLogGroup
10461046
try:
1047-
if service == "logs":
1047+
if source == "aws.logs":
10481048
log_group = data.get('detail', {}).get('requestParameters', {}).get('logGroupName', '')
10491049
event_name = data.get('detail', {}).get('eventName', None)
1050-
if event_name in ["CreateLogGroup", "CreateLogStream"] and log_group.startswith('/aws/lambda'):
1050+
# Capture Lambda@edge
1051+
if event_name in ["CreateLogGroup", "CreateLogStream"] and \
1052+
(log_group.startswith('/aws/lambda/us-east-1.') or log_group.startswith('/test-subscription')):
10511053
# Create a subscription filter
10521054
cwlogs = boto3.client("logs")
10531055
try:

0 commit comments

Comments
 (0)