A SysOps Administrator is configuring a monitoring solution for a microservice that publishes system events to an Amazon CloudWatch log group named `/aws/microservices/order-processor`. The application outputs log messages in the following JSON format:
{
"request_id": "req-9481",
"status": "FAILURE",
"error_code": "ERR_PAYMENT_DECLINED",
"processing_time_ms": 1420
}
The administrator needs to monitor for instances where payments are declined and trigger automated notifications. Which two actions must the administrator perform to achieve this requirement?
- Create a CloudWatch Logs metric filter with the filter pattern `{ $.error_code = "ERR_PAYMENT_DECLINED" }` that increments a custom metric by 1 when a match is found.Cevap
- Create a CloudWatch alarm that monitors the custom metric and is configured to send a notification to an Amazon SNS topic when the metric exceeds the defined threshold.Cevap
- CEnable detailed monitoring on the microservice host instances to ensure the custom log metric is updated and reported at 1-minute intervals.
- DConfigure an Amazon EventBridge rule with an event pattern matching the `/aws/microservices/order-processor` log group to directly trigger an Amazon SNS notification when a declined payment event is logged.
- EConfigure the retention settings of the metric filter to ensure that logs matching the declined payment pattern are stored indefinitely while other logs are expired.
Cevap
The administrator must create a CloudWatch Logs metric filter with the filter pattern `{ $.error_code = "ERR_PAYMENT_DECLINED" }` to increment a custom metric, and then create a CloudWatch alarm to monitor that custom metric and trigger notifications to an Amazon SNS topic.
To detect specific events in JSON logs and send notifications, a metric filter must be created with the pattern `{ $.error_code = "ERR_PAYMENT_DECLINED" }` to publish data to a custom metric. A CloudWatch alarm is then set up to monitor that custom metric and trigger an action, such as sending a notification to an Amazon SNS topic when the threshold is breached.
Adım Adım Çözüm
Anahtar Kavram
Using CloudWatch Logs metric filters to extract metrics from JSON-formatted log files and triggering alerts using CloudWatch alarms and Amazon SNS.
Tahmini Süre:2m 0s