Q68 — AWS SOA-C02 Ch.1

Question 68 of 100 | ← Chapter 1

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?

Correct Answer: A. Create a CloudWatch Logs metric filter that counts the number of times that the web server returns an HTTP 404 response.

Explanation

AWS CloudWatch Logs的指标过滤器功能允许用户直接从日志事件中提取数据并转换为自定义指标,用于实时监控和分析。Amazon CloudWatch文档指出,指标过滤器适用于无需自定义代码即可统计特定日志模式的出现次数。选项A通过创建指标过滤器,可自动将HTTP 404响应码的出现次数转换为可视化的CloudWatch指标,无需额外脚本或服务集成。选项B的订阅过滤器通常用于将日志数据流式传输到其他AWS服务进行处理,增加了复杂性;选项C和D依赖定期执行的查询或脚本,缺乏实时性且运维成本较高。