An application running on Amazon EC2 writes log events to a local file in a space-delimited text format. The CloudWatch agent is configured to send these logs to an Amazon CloudWatch Logs log group. A typical log event looks like this:
`2026-07-14 WARN req-8812 450 502`
The positions of the values represent `[timestamp, log_level, request_id, latency_ms, status_code]`.
A developer wants to create a metric filter to capture the latency of requests that result in either a `WARN` or `ERROR` log level. The metric filter must extract the `latency_ms` value to publish a custom metric. The developer's initial attempt at configuring the metric filter pattern is `{ .log_level == "ERROR" }` with a metric value of `$.latency_ms`. This configuration does not match any log events and fails to publish the metric.
Which of the following changes must the developer make to the metric filter configuration to correctly parse the logs and extract the latency metric? (Select TWO.)
- Define the filter pattern using square brackets to name the fields, such as: `[timestamp, log_level = "WARN" || log_level = "ERROR", request_id, latency_ms, status_code]`Answer
- Specify the metric value as `$latency_ms` to reference the extracted field.Answer
- CDefine the filter pattern using curly braces to parse the fields, such as: `{ .log_level = "ERROR" }`
- DSpecify the metric value as `$.latency_ms` in the metric value field to match the JSON path syntax.
- EReference the metric value as `latency_ms` without any prefix, as CloudWatch automatically maps the variable name from the pattern.