Soru

Zorluk: KolayMonitoring and Analyzing Logs with Amazon CloudWatch

A developer is troubleshooting an AWS Lambda function that occasionally terminates abruptly. To measure the frequency of these occurrences, the developer wants to create an Amazon CloudWatch metric that increments every time a function execution times out. The Lambda log group contains standard timeout log entries, such as:

`2026-07-14T12:00:00.000Z 88888888-4444-4444-4444-121212121212 Task timed out after 10.03 seconds`

Which log metric filter pattern must the developer configure on the log group to accurately capture only these timeout events?

  1. A
    $.message = "Task timed out"
  2. "Task timed out"Cevap
  3. C
    [date, timestamp, message = "*Task timed out*"]
  4. D
    Increase the Lambda function's timeout configuration to 1515 minutes

Cevap

"Task timed out"
The correct answer is the option specifying the exact phrase in double quotes. In Amazon CloudWatch Logs, filter patterns for unstructured plain text logs can match an exact phrase by enclosing the phrase in double quotes. Since the standard Lambda timeout message contains the phrase "Task timed out", this pattern will match the line and increment the metric.

Adım Adım Çözüm

1
Identify the format of the target log entry.
The log message is unstructured plain text containing the phrase "Task timed out".
Choosing the correct filter pattern syntax depends on whether the log is structured (JSON), space-delimited, or plain text.
2
Determine the appropriate CloudWatch Logs filter pattern syntax for plain text phrase matching.
A plain text search pattern uses double quotes around the exact phrase to match, resulting in "Task timed out".
Enclosing the phrase in double quotes performs an exact substring match on unstructured logs.

Anahtar Kavram

CloudWatch Metric Filter syntax for unstructured text logs
Tahmini Süre:45s
Bu soruyu puanla