An application logs HTTP requests to an Amazon CloudWatch Log Group in a space-delimited format:
`timestamp request_id client_ip api_endpoint status_code latency_ms`
Example log event:
`1783987200 req-98765 203.0.113.55 /checkout 503 1240`
A SysOps Administrator must monitor checkout transaction failures. The requirements are:
- A CloudWatch alarm must trigger if there are more than 5 failures (where `status_code` is 500 or greater) on the `/checkout` endpoint within a 5-minute period.
- The custom metric must record a value of 0 when checkout transactions are processed but do not result in a 5XX error, preventing the alarm from entering an `INSUFFICIENT_DATA` state.
- If there is no traffic to the `/checkout` endpoint at all (no logs written), the alarm must remain in an `OK` state.
- Log data must not be stored indefinitely to control AWS costs, with a maximum retention of 30 days.
Which configuration strategy should the SysOps Administrator implement to meet these requirements?
- Configure the CloudWatch Log Group retention period to 30 days. Create a metric filter with the pattern `[timestamp, request_id, client_ip, api_endpoint = "/checkout", status_code >= 500, latency_ms]`, setting the metric value to 1 and the default value to 0. Create a CloudWatch alarm based on this metric with a threshold of 5, and set its TreatMissingData behavior to notBreaching.Cevap
- BCreate a metric filter with the pattern `[timestamp, request_id, client_ip, api_endpoint = "/checkout", status_code >= 500, latency_ms]`, setting the metric value to 1 and the default value to 0. Leave the CloudWatch Log Group retention period at its default setting. Create a CloudWatch alarm on this metric with a threshold of 5, and configure its TreatMissingData behavior to missing.
- CEnable detailed monitoring on the EC2 instances hosting the application to support log-based custom metric publication. Create a metric filter with the pattern `[timestamp, request_id, client_ip, api_endpoint = "/checkout", status_code >= 500, latency_ms]`, setting the metric value to 1 and leaving the default value empty. Set the log group retention to 30 days. Create a CloudWatch alarm with a threshold of 5, and set its TreatMissingData behavior to notBreaching.
- DCreate an Amazon EventBridge rule that triggers whenever any log event is written to the log group. Use an EventBridge input transformer to parse the log line for "/checkout" and status codes >= 500, then publish a custom metric to CloudWatch with a value of 1. Set the log group retention to 30 days. Create a CloudWatch alarm with a threshold of 5, and configure its TreatMissingData behavior to ignore.