An application on EC2 instances writes a login log that includes username, date, time, and source IP to a CloudWatch Logs log group. For a root-cause analysis, the company must determine how many times a specific user logged in over the past 7 days. Which approach will provide that count?
Choose an answer
Tap an option to check your answer.
Correct answer: Run a CloudWatch Logs Insights query against the log group that uses an aggregation function to count the username's logins over the past 7 days..
Why this is the answer
CloudWatch Logs Insights is the most efficient and direct method for ad-hoc analysis and querying log data. It allows you to run powerful queries, including aggregation functions like count(), over specified time ranges (e.g., the last 7 days) directly on your log groups. This eliminates the need for pre-configuration. Creating a CloudWatch Logs metric filter would require defining a specific pattern beforehand and would only count future occurrences from the point of creation, not historical data. A subscription filter sends logs to another destination, but doesn't directly provide a count within CloudWatch. A CloudWatch dashboard widget can display metrics, but it relies on existing metrics or Logs Insights queries; it doesn't perform the direct filtering and counting on raw logs itself for historical data in the way Logs Insights does.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed