AWS Certified SysOps Administrator – Associate — Question 136
A company hosts a web application on an Amazon EC2 instance. The web server logs are published to Amazon CloudWatch Logs. The log events have the same structure and include the HTTP response codes that are associated with the user requests. The company needs to monitor the number of times that the web server returns an HTTP 404 response.
What is the MOST operationally efficient solution that meets these requirements?
Answer options
- A. Create a CloudWatch Logs metric filter that counts the number of times that the web server returns an HTTP 404 response.
- B. Create a CloudWatch Logs subscription filter that counts the number of times that the web server returns an HTTP 404 response.
- C. Create an AWS Lambda function that runs a CloudWatch Logs Insights query that counts the number of 404 codes in the log events during the past hour.
- D. Create a script that runs a CloudWatch Logs Insights query that counts the number of 404 codes in the log events during the past hour.
Correct answer: A
Explanation
The correct answer is A because using a CloudWatch Logs metric filter is the most direct and efficient method to count occurrences of specific log events, such as HTTP 404 responses. Options B, C, and D involve additional complexity or overhead, such as creating a subscription filter or running queries via Lambda or scripts, which are less operationally efficient.