Send CloudTrail management events to CloudWatch Logs, filter failed ConsoleLogin, and alarm to SNS

Answer Correct answer: A — send management events to CloudWatch Logs, filter failed ConsoleLogin events, and alarm to SNS.

A company detects unusual login attempts in many of its AWS accounts. A DevOps engineer must implement a solution that sends a notification to the company's security team when multiple failed login attempts occur. The DevOps engineer has already created an Amazon Simple Notification Service (Amazon SNS) topic and has subscribed the security team to the SNS topic. Which solution will provide the notification with the LEAST operational effort?

  1. Configure AWS CloudTrail to send management events to an Amazon CloudWatch Logs log group. Create a CloudWatch Logs metric filter to match failed ConsoleLogin events. Create a CloudWatch alarm that is based on the metric filter. Configure an alarm action to send messages to the SNS topic. Correct Answer
  2. Configure AWS CloudTrail to send management events to an Amazon S3 bucket. Create an Amazon Athena query that returns a failure if the query finds failed logins in the logs in the S3 bucket. Create an Amazon EventBridge rule to periodically run the query. Create a second EventBridge rule to detect when the query fails and to send a message to the SNS topic.
  3. Configure AWS CloudTrail to send data events to an Amazon CloudWatch Logs log group. Create a CloudWatch logs metric filter to match failed ConsoleLogin events. Create a CloudWatch alarm that is based on the metric filter. Configure an alarm action to send messages to the SNS topic.
  4. Configure AWS CloudTrail to send data events to an Amazon S3 bucket. Configure an Amazon S3 event notification for the s3:ObjectCreated event type. Filter the event type by ConsoleLogin failed events. Configure the event notification to forward to the SNS topic.

Community Votes

A
100%

100% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

The chain must start from management events because that is where console sign-ins are recorded, and it must terminate in an alarm because the requirement is a threshold on the number of failures rather than a single occurrence (A). A metric filter is what converts matching log events into a metric that an alarm can evaluate, and the alarm action notifies SNS directly, which is the least-effort path. Option C uses data events, which cover resource operations such as S3 object-level access, not console sign-ins. Options B and D introduce S3 with periodic Athena queries or S3 event notifications, neither of which can filter on log content.

Console sign-in activity is recorded by CloudTrail as management events, so those events are what must be delivered to CloudWatch Logs. A CloudWatch Logs metric filter matching failed ConsoleLogin events turns those log records into a metric, a CloudWatch alarm is created on that metric so it fires when multiple failures occur, and an alarm action sends the message to the existing SNS topic the security team is subscribed to. Every element is a managed, event-driven service, so no polling or custom code is needed.

Configuring CloudTrail to send data events to CloudWatch Logs (C) — data events capture resource operations such as S3 object-level API calls, Lambda invocations, and DynamoDB item changes; console sign-in activity such as ConsoleLogin is recorded as a management event, so a data-event log group would contain no ConsoleLogin records for the metric filter to match and the alarm would never fire. On9son made the complementary point that CloudTrail publishes logs to S3 and that management events contain the login information. Sending events to S3 and running Athena queries on an EventBridge schedule (B) — eugene2owl noted it might work but is far more overcomplicated, requiring a query, a scheduled rule, and a second rule to detect failure. Using S3 event notifications filtered on ConsoleLogin (D) — S3 object-created notifications fire on object writes and cannot filter on the content of a log record.

Community Discussion (4 comments)

eugene2owl 👍 5 Selected: A
"A" is indeed the most elegant and obvious solution. "B" might work but seems way more overcomplicated
Srikantha 👍 1 Selected: A
This solution leverages AWS CloudTrail for logging, CloudWatch Logs for capturing the log data, and CloudWatch Alarms for monitoring the failed login attempts, with SNS used for notifications. It provides the least operational effort for the following reasons: AWS CloudTrail captures management events, including failed login attempts (ConsoleLogin failures). These events are sent to Amazon CloudWatch Logs, which is a straightforward way to centralize the log data for analysis. A CloudWatch Logs metric filter is created to match the ConsoleLogin failure events. This metric filter scans the CloudWatch logs for specific failed login attempts. CloudWatch Alarm is created based on the metric filter to trigger when there are multiple failed login attempts. The alarm is configured to send a message to the SNS topic, notifying the security team. This solution automates the detection of failed login attempts and provides a simple, efficient way to send notifications with minimal ongoing management.
teo2157 👍 4 Selected: A
A as you can choose to send cloudtrail events to CloudWatch log groups.
On9son 👍 1 Selected: B
CloudTrail publishes log to S3. And management event contains login information https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-events.html#cloudtrail-management-events

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

Console sign-in activity is recorded by CloudTrail as a management event, so the first requirement is to deliver management events to a CloudWatch Logs log group (A). A CloudWatch Logs metric filter with a pattern matching failed ConsoleLogin events then converts those log records into a metric, which is what makes the count of failures observable and alarmable (A). A CloudWatch alarm based on that metric filter fires when the number of failures crosses the configured threshold, which is what the requirement for multiple failed login attempts calls for, and an alarm action sends messages to the Amazon SNS topic the security team is already subscribed to (A). Every component is a managed service operating event-driven, so there is nothing to poll, schedule, or code, which is what the least-operational-effort requirement points to. Srikantha described this as leveraging CloudTrail for logging, CloudWatch Logs for capturing the log data, CloudWatch Alarms for monitoring, and SNS for notification, and teo2157 confirmed that CloudTrail events can be sent to CloudWatch log groups. A is the correct answer.

Why the Other Options Are Wrong

C configures CloudTrail to send data events to CloudWatch Logs and creates a metric filter matching failed ConsoleLogin events on that log group. Data events record resource-level operations such as S3 object-level access, Lambda function invocations, and DynamoDB item-level changes; console sign-ins are management events, so a log group receiving only data events would contain no ConsoleLogin records, the metric filter would match nothing, and the alarm would never fire. On9son made the complementary observation that management events are what carry the login information. B sends management events to an S3 bucket, creates an Athena query that fails if it finds failed logins, creates an EventBridge rule to run that query periodically, and creates a second rule to notify SNS when the query fails. As eugene2owl observed, this might function but is dramatically more overcomplicated, since it requires a query, a scheduled invocation, and a second rule to detect the failure, versus a metric filter and an alarm. D sends data events to S3 and configures an S3 event notification for s3:ObjectCreated filtered on ConsoleLogin failures. S3 event notifications fire on object creation and cannot filter on the contents of a log record, so the ConsoleLogin condition could never be applied. A is correct.

Community Comment Notes

Community voted A (91). Srikantha described the four-service chain and stated it provides the required notification efficiently. eugene2owl identified A as the most elegant and obvious solution and noted that B might work but seems far more overcomplicated, which is the decisive operational point. teo2157 confirmed A on the basis that CloudTrail events can be sent to CloudWatch log groups. On9son was the sole dissenter, favouring B on the grounds that CloudTrail publishes logs to S3 and that management events contain login information, which is true but does not outweigh the operational overhead of scheduled Athena queries and a second rule. No alternative received support.

Official Reference

Related Analysis

Practice All DOP-C02 Questions

Access 85 questions with complete answers and detailed explanations.

View Full DOP-C02 Practice Test →

← Back to DOP-C02 Study Guide