diff --git a/src/main.py b/src/main.py index cace951..bbd94cc 100644 --- a/src/main.py +++ b/src/main.py @@ -175,7 +175,7 @@ def should_message_be_processed( def push_total_access_denied_events_cloudwatch_metric() -> None: """Pushes CloudWatch metrics for all AccessDenied events.""" - logger.info({"Pushing TotalAccessDeniedEvents CloudWatch metric"}) + logger.info({"Info":"Pushing TotalAccessDeniedEvents CloudWatch metric"}) metrics = [ { "MetricName": "TotalAccessDeniedEvents", @@ -186,14 +186,14 @@ def push_total_access_denied_events_cloudwatch_metric() -> None: ] try: cloudwatch_client.put_metric_data(Namespace="CloudTrailToSlack/AccessDeniedEvents", MetricData=metrics) - logger.info({"Pushed TotalAccessDeniedEvents CloudWatch metric"}) + logger.info({"Info":"Pushed TotalAccessDeniedEvents CloudWatch metric"}) except Exception as e: logger.exception({"Failed to push CloudWatch metrics": {"error": e}}) def push_total_ignored_access_denied_events_cloudwatch_metric() -> None: """Pushes CloudWatch metrics for ignored AccessDenied events only.""" - logger.info({"Pushing TotalIgnoredAccessDeniedEvents CloudWatch metric"}) + logger.info({"Info":"Pushing TotalIgnoredAccessDeniedEvents CloudWatch metric"}) metrics = [ { "MetricName": "TotalIgnoredAccessDeniedEvents", @@ -204,7 +204,7 @@ def push_total_ignored_access_denied_events_cloudwatch_metric() -> None: ] try: cloudwatch_client.put_metric_data(Namespace="CloudTrailToSlack/AccessDeniedEvents", MetricData=metrics) - logger.info({"Pushed TotalIgnoredAccessDeniedEvents CloudWatch metric"}) + logger.info({"Info": "Pushed TotalIgnoredAccessDeniedEvents CloudWatch metric"}) except Exception as e: logger.exception({"Failed to push CloudWatch metrics": {"error": e}}) @@ -234,9 +234,9 @@ def handle_event( logger.debug({"Processing result": {"result":result}}) if flatten_json(event).get("errorCode", "").startswith(("AccessDenied")): - logger.info({"Event is AccessDenied"}) + logger.info({"Info": "Event is AccessDenied"}) if cfg.push_access_denied_cloudwatch_metrics is True: - logger.info({"Pushing AccessDenied CloudWatch metrics"}) + logger.info({"Info":"Pushing AccessDenied CloudWatch metrics"}) push_total_access_denied_events_cloudwatch_metric() if result.is_ignored: push_total_ignored_access_denied_events_cloudwatch_metric()