A SysOps Administrator is configuring monitoring for a database backup process. The backup application streams JSON-formatted logs to an Amazon CloudWatch Logs group. A typical log event has the following structure:
{
"backupId": "backup-98234",
"status": "Failed",
"durationSeconds": 1450,
"database": "prod-db-01"
}
The administrator needs to monitor the duration of failed backups. Specifically, they want to create a custom CloudWatch metric that records the value of `durationSeconds` only when `status` is equal to `"Failed"`. To avoid alarm flapping and false alerts when no failures occur, the custom metric must report a value of `0` during periods with no matching log events.
Which configuration should the administrator use to achieve this?
- ACreate a metric filter with the filter pattern { .status = "Failed" } and a Metric Value of .durationSeconds. Enable EC2 Detailed Monitoring on the application servers to ensure that the custom log-derived metric is updated at 1-minute intervals rather than the default 5-minute interval.
- BCreate an Amazon EventBridge rule that triggers on any write to the log group. Route the event to an AWS Systems Manager Automation runbook that parses the JSON payload, extracts the durationSeconds value, and publishes it using PutMetricData with a default value of 0 when failures are absent.
- Create a metric filter with the filter pattern { .status = "Failed" }. Configure the metric transformation with a Metric Value of .durationSeconds and a Default Value of 0.Cevap
- DCreate a metric filter with the filter pattern { .status = "Failed" }. Configure the metric transformation with a Metric Value of .durationSeconds. Change the CloudWatch Logs group retention policy to "Never Expire" to prevent the custom metric's historical data points from being deleted when log events expire.