What is the MOST operationally efficient solution that meets these requirements?
Create a CloudWatch Logs metric filter that counts the number of times that the web server returns an HTTP 404 response.
Create a CloudWatch Logs subscription filter that counts the number of times that the web server returns an HTTP 404 response.
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.
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.
Explanations:
A CloudWatch Logs metric filter can be used to automatically count occurrences of HTTP 404 responses directly within CloudWatch Logs. This solution is fully automated, operationally efficient, and requires minimal manual intervention.
A CloudWatch Logs subscription filter is designed for streaming log data to other services, such as Lambda or Kinesis, rather than directly counting log events. This is not the most efficient solution for just counting 404 responses.
AWS Lambda with CloudWatch Logs Insights is more complex and not as efficient for this use case. While it can perform the query, it introduces unnecessary overhead by running a Lambda function periodically instead of directly counting with a metric filter.
A script that runs a CloudWatch Logs Insights query is manual and requires constant execution. This solution is less operationally efficient compared to using a metric filter that automatically counts the 404 responses.