The application writes access logs to a CloudWatch Logs log group; each log line contains the response code and application name. You need a CloudWatch metric that counts requests whose response code falls within a specific range and that have a specific application name. What approach satisfies this requirement?
Choose an answer
Tap an option to check your answer.
Correct answer: Create a CloudWatch Logs metric filter on the CloudWatch Logs log group that matches the response code range, configure the metric filter to increment a metric, and set the response code and application name as dimensions..
Why this is the answer
The correct option is to create a CloudWatch Logs metric filter on the log group. Metric filters are designed to extract numerical values from log events and transform them into CloudWatch metrics. You can define a filter pattern to match the desired response code range and then specify the application name and response code as dimensions for the new metric. This allows for granular monitoring and alarming based on specific log content. Incorrect options: Creating a log event filter on a specific log stream is not a standard CloudWatch Logs feature for generating metrics; metric filters operate at the log group level. CloudWatch Contributor Insights is used to analyze high-cardinality data and identify top contributors, not directly for creating custom metrics from log patterns. CloudWatch Logs Insights is a query language for analyzing log data and can't directly increment a CloudWatch metric based on query results. It's for ad-hoc analysis, not continuous metric generation.
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