DEA-C01 · Question #208
A data engineer created a table named cloudtrail_logs in Amazon Athena to query AWS CloudTrail logs and prepare data for audits. The data engineer needs to write a query to display errors with error…
The correct answer is A. select count (*) as TotalEvents, eventname, errorcode, errormessage from cloudtrail_logswhere. The correct query (Option A) must satisfy three conditions: (1) filter for records where errorcode is not null (excluding successful calls) and where the event timestamp is on or after 2024-01-01, (2) group by eventname, errorcode, and errormessage to aggregate counts per error…
Question
A data engineer created a table named cloudtrail_logs in Amazon Athena to query AWS CloudTrail logs and prepare data for audits. The data engineer needs to write a query to display errors with error codes that have occurred since the beginning of 2024. The query must return the 10 most recent errors. Which query will meet these requirements?
Options
- Aselect count (*) as TotalEvents, eventname, errorcode, errormessage from cloudtrail_logswhere
- Bselect count (*) as TotalEvents, eventname, errorcode, errormessage from cloudtrail_logs where
- Cselect count (*) as TotalEvents, eventname, errorcode, errormessage from cloudtrail_logswhere
- Dselect count (*) as TotalEvents, eventname, errorcode, errormessage from cloudtrail_logs where
How the community answered
(36 responses)- A75% (27)
- B17% (6)
- C3% (1)
- D6% (2)
Explanation
The correct query (Option A) must satisfy three conditions: (1) filter for records where errorcode is not null (excluding successful calls) and where the event timestamp is on or after 2024-01-01, (2) group by eventname, errorcode, and errormessage to aggregate counts per error type, and (3) limit to the 10 most recent or most frequent errors. Option A is the only choice that correctly combines all three: a WHERE clause filtering on errorcode IS NOT NULL and eventtime >= '2024-01-01', a GROUP BY clause on the non-aggregated columns, and a LIMIT 10 clause. The other options either use incorrect date filtering syntax, omit the errorcode IS NOT NULL filter, or sort/limit incorrectly.
Topics
Community Discussion
No community discussion yet for this question.