Skip to content

Commit

Permalink
fix: push_cloudwatch_metrics before ignore rule evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
EreminAnton committed Nov 1, 2024
1 parent 8117dc4 commit b84244b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,16 @@ def handle_event(
slack_config=slack_config,
)

if not result.should_be_processed:
return

# log full event if it is AccessDenied
if "errorCode" in event and "AccessDenied" in event["errorCode"]:
event_as_string = json.dumps(event, indent=4)
logger.info({"errorCode": "AccessDenied", "log full event": event_as_string})
# Push CloudWatch metrics
push_cloudwatch_metrics(deny_type=event["errorCode"], event_name=event.get("eventName", "UnknownEvent"))

if not result.should_be_processed:
return

message = event_to_slack_message(event, source_file_object_key, account_id)

send_message_to_sns(
Expand Down

0 comments on commit b84244b

Please sign in to comment.