A web application on EC2 streams logs to CloudWatch Logs. The company must receive an SNS notification when application error messages exceed a defined threshold within a 5-minute window. Which solution accomplishes this?
Choose an answer
Tap an option to check your answer.
Correct answer: Create a CloudWatch Logs metric filter that matches the application error pattern, create a CloudWatch alarm on that custom metric, and configure the alarm to send an SNS notification when errors exceed the threshold within 5 minutes..
Why this is the answer
The correct solution involves using CloudWatch Logs' native capabilities. A CloudWatch Logs metric filter can extract specific patterns (like "error") from log events and transform them into numerical CloudWatch metrics. Once a custom metric is created, a CloudWatch alarm can be set on this metric. The alarm can then be configured to trigger an SNS notification when the metric (representing the count of errors) exceeds a specified threshold within a defined period (e.g., 5 minutes). Modifying the application to stream directly to SNS is inefficient and bypasses the robust log management features of CloudWatch Logs. Adding a subscription filter to a log group can forward logs to other services, but it doesn't inherently provide the aggregation and thresholding capabilities needed for this specific problem without additional services. Amazon Inspector is a security assessment service, not a log monitoring and alerting service for application errors.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed