Question

Difficulty: MediumCloudWatch Logs and Metric Filters

An application deployed on AWS Lambda writes execution logs to an Amazon CloudWatch Logs group. A SysOps Administrator needs to configure a metric filter and a CloudWatch alarm to track occurrences where a specific third-party integration named `StripePay` fails with a response time greater than 1000 ms1000\text{ ms}.

A sample JSON log event from the application is:

{
"integrationName": "StripePay",
"status": "FAILED",
"responseTimeMs": 1250,
"errorCode": "GATEWAY_TIMEOUT"
}

Which of the following configuration options should the SysOps Administrator select to meet these requirements? (Select TWO.)

  1. Define a metric filter with the pattern `{ (.integrationName = "StripePay") && (.status = "FAILED") && ($.responseTimeMs > 1000) }`.Answer
  2. Set the metric value in the metric transformation configuration to `1` to increment the metric count for each log event that matches the filter pattern.Answer
  3. C
    Configure the log group retention period to Never Expire to allow the metric filter to scan historical log data and backfill the custom metric.
  4. D
    Enable detailed monitoring on the Lambda function to increase the log ingestion frequency to CloudWatch Logs to 1-minute intervals.
  5. E
    Create an Amazon EventBridge rule that monitors the custom metric namespace directly to trigger an AWS Systems Manager Automation runbook.

Answer

To monitor the third-party failures, the administrator must define a metric filter with the JSON pattern checking for StripePay, FAILED status, and responseTimeMs greater than 1000, and set the metric transformation value to 1 to count the occurrences of matching events.
The correct options are defining the metric filter with the JSON pattern selecting StripePay, FAILED status, and response time greater than 1000, and setting the metric transformation value to 1. This ensures that every matching log event increments the count of the custom metric by 1 in real-time.

Step-by-Step Solution

1
Select the correct CloudWatch Logs JSON filter pattern syntax.
The pattern `{ (.integrationName = "StripePay") && (.status = "FAILED") && ($.responseTimeMs > 1000) }` matches the structure of the JSON log event.
JSON metric filters use JSON path notation with `$.` to access properties and boolean operators like `&&` to combine conditions.
2
Configure the metric transformation properties for the custom metric.
Assign a metric value of `1` for each match.
Setting the metric value to 1 allows the custom metric to increment by one per matching log event, reflecting the frequency of StripePay failures.
3
Create a CloudWatch Alarm to monitor the custom metric.
The alarm triggers when the metric value exceeds the desired threshold.
An alarm is necessary to notify administrators or trigger remediation via EventBridge when the failure count is too high.

Key Concept

CloudWatch Logs Metric Filters analyze incoming log streams in real-time using pattern matching rules to publish custom CloudWatch metrics.
Rate this question