AWS Certified Developer – Associate (DVA-C02) — Question 110
A developer wants to debug an application by searching and filtering log data. The application logs are stored in Amazon CloudWatch Logs. The developer creates a new metric filter to count exceptions in the application logs. However, no results are returned from the logs.
What is the reason that no filtered results are being returned?
Answer options
- A. A setup of the Amazon CloudWatch interface VPC endpoint is required for filtering the CloudWatch Logs in the VPC.
- B. CloudWatch Logs only publishes metric data for events that happen after the filter is created.
- C. The log group for CloudWatch Logs should be first streamed to Amazon OpenSearch Service before metric filtering returns the results.
- D. Metric data points for logs groups can be filtered only after they are exported to an Amazon S3 bucket.
Correct answer: B
Explanation
The correct answer is B because CloudWatch Logs only starts publishing metric data for events that happen after the filter is created, meaning any prior log entries will not be counted. Options A, C, and D are incorrect as they refer to unnecessary configurations or processes that do not apply to the immediate issue of metric filtering results.