Course menuDVA-C02

Exams / DVA-C02 / Logging and CloudWatch Logs Insights / Question 1

DVA-C02 practice question: Logging and CloudWatch Logs Insights (1 of 2)

Troubleshooting and Optimization A free question from our original DVA-C02 practice exam. Try it, then open the answer to see why each option is right or wrong.

A developer is investigating intermittent failures in a Lambda function and wants to see the 25 most recent log events in its log group that contain the word Timeout anywhere in the message. Which CloudWatch Logs Insights query returns this?

Choose one answer.

  1. A. fields @timestamp, @message | stats count(*) by @message | limit 25
  2. B. filter @message like /Timeout/ | sort @timestamp desc | limit 25
  3. C. filter @message like /Timeout/ | sort @timestamp asc | limit 25
  4. D. filter @message = "Timeout" | sort @timestamp desc | limit 25
Show the answer and explanation

Answer: B

  • A. Wrong: This counts events grouped by message text. It does not filter for Timeout or show the latest events.
  • B. Right: Correct. The filter keeps events containing Timeout, the sort puts the newest first, and limit returns 25.
  • C. Wrong: Sorting in ascending order returns the 25 oldest matching events, not the most recent.
  • D. Wrong: An equality test only matches events whose entire message is exactly Timeout, so most matching lines are missed.

Explanation

Logs Insights queries chain commands with pipes. fields chooses what to show, filter with like and a regular expression matches part of a field, sort orders results and limit caps how many are returned. @timestamp and @message are discovered automatically.

Study

Keep practising

Answer questions with a score at the end, or practise just this topic with the explanation after each one. No sign-up needed.