AWS Certified SysOps Administrator – Associate (SOA-C03) — Question 61
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 creating a CloudWatch Logs metric filter is a straightforward and efficient way to track specific log events, such as HTTP 404 responses, without needing additional resources. Options B, C, and D involve more complexity and operational overhead, such as setting up subscription filters or running queries, which are not as efficient for this specific monitoring task.