A developer is troubleshooting an application where messages are being processed multiple times from an Amazon SQS queue. The developer suspects that the consumer AWS Lambda function is timing out during execution, causing messages to return to the queue. The developer wants to monitor and analyze these timeouts using Amazon CloudWatch Logs.
Which of the following actions should the developer take to correctly identify and track these execution timeouts? (Select TWO.)
- Create a CloudWatch metric filter on the Lambda function's log group using the filter pattern "\"Task timed out\"" to increment a custom metric.Cevap
- Use Amazon CloudWatch Logs Insights to run a query with the command "filter @message like /Task timed out/" on the Lambda function's log group.Cevap
- CCreate a CloudWatch metric filter on the log group using the filter pattern "Task timed out" (without double quotes) to count the occurrences of the timeout message.
- DImplement a try-catch block within the Lambda function handler to catch the execution timeout and write a custom log entry to CloudWatch Logs.
- EConfigure a CloudWatch metric filter using the JSON pattern "{ $.errorMessage = \"Task timed out*\" }" to extract the error details.
Cevap
Create a CloudWatch metric filter with the quoted pattern "Task timed out" to count occurrences of timeouts, and use CloudWatch Logs Insights to query the log group with a filter mapping the timeout phrase.
The correct options involve creating a CloudWatch metric filter using the exact phrase search pattern enclosed in double quotes (which allows tracking the exact phrase written by the Lambda service), and using CloudWatch Logs Insights with a string match filter to query these plain text timeout logs.
Adım Adım Çözüm
Anahtar Kavram
Monitoring plain text Lambda runtime logs in CloudWatch using exact phrase metric filters and Logs Insights queries.