DOP-C02 Practice Question 58: Logs Insights Adhoc Query
AWS Certified DevOps Engineer – Professional (DOP-C02) · Test 6 · question 8 of 10
A developer needs to find the 10 slowest requests logged by a Lambda function in the last hour. The function writes structured JSON log entries to a CloudWatch Logs log group, and each entry includes a duration field in milliseconds. The developer needs the answer once, right now, and does not want to provision any new infrastructure to get it.
Which approach requires the least effort?
Show answer and explanation
Answer:
CloudWatch Logs Insights runs ad hoc queries directly against an existing log group with no setup: it parses the JSON fields automatically, and a query that sorts by duration and limits the results to 10 returns exactly the slowest individual requests, complete with their timestamps, in seconds and with no new resource created.
Option A works but requires exporting the log group and defining an external table before the first query can even run, far more setup than a one-off question needs.
Option B, a metric filter, aggregates matching log events into a single numeric time series; it can show that latency spiked, but a metric has no per-event fields, so it cannot list the 10 specific requests that were slowest.
Option C is the wrong feature: Container Insights collects and visualizes metrics for containerized workloads on ECS, EKS and Kubernetes; it has no relationship to Lambda's own log group and no top requests panel for arbitrary JSON log fields.