Soru

Zorluk: ZorCloudWatch Logs and Metric Filters

A SysOps Administrator is configuring a monitoring solution for a microservice running on AWS. The application outputs structured JSON logs to an Amazon CloudWatch Logs log group. Below is a sample log event:

{
"eventType": "OrderDelivery",
"details": {
"status": "Failed",
"retryCount": 3,
"latencyMs": 450
}
}

The administrator needs to monitor this log group and trigger an alert if there are frequent occurrences of order deliveries that fail after 3 or more retries. The administrator wants to ensure that the alarm evaluates correctly even during periods of zero traffic when no logs are generated.

Which TWO configuration steps should the administrator perform to meet these requirements? (Select TWO.)

  1. Create an Amazon CloudWatch Logs metric filter with the filter pattern { .details.status = "Failed" && .details.retryCount >= 3 }.Cevap
  2. In the metric transformation configuration, specify a metric value of 1 and set the default value of the metric to 0.Cevap
  3. C
    Enable detailed monitoring for the CloudWatch Log Group in the AWS Management Console to decrease the custom metric reporting interval to 1 minute.
  4. D
    Configure a log group retention policy of 0 days to purge log streams immediately after metric extraction, avoiding storage charges.
  5. E
    Define the filter pattern using SQL syntax SELECT COUNT(*) WHERE status = 'Failed' AND retryCount >= 3 and configure Amazon EventBridge to query the log group.

Cevap

The correct steps are to create a metric filter with the JSON path pattern targeting status and retryCount, and to configure the metric transformation with a metric value of 1 and a default value of 0.
Defining the filter pattern using the JSON path notation to check nested fields matches the specific log structure. Setting a default value of 0 in the metric transformation ensures that CloudWatch reports a data point even when no matching events occur, preventing the metric from reporting insufficient data during zero-traffic periods.

Adım Adım Çözüm

1
Analyze the JSON log structure and identify the correct JSON path for the target fields.
The target fields are 'status' and 'retryCount', nested inside the 'details' object, represented as '.details.statusand.details.status' and '.details.retryCount'.
This allows us to construct a syntactically correct CloudWatch Logs filter pattern.
2
Construct the JSON filter pattern using proper operators.
The pattern is { .details.status = "Failed" && .details.retryCount >= 3 }.
This matches only log events where order delivery failed and has 3 or more retries.
3
Configure the metric transformation to handle zero-traffic scenarios.
Set the metric value to 1 and specify a default value of 0.
This guarantees that the metric reports 0 when there is no matching log activity, ensuring the alarm does not fall into an INSUFFICIENT_DATA state.

Anahtar Kavram

CloudWatch Logs Metric Filters and JSON Filter Patterns
Tahmini Süre:2m 0s
Bu soruyu puanla