How it works...
In this recipe, we used Amazon Athena to query CloudTrail logs in S3. Athena uses queries based on Structured Query Language (SQL) and creates virtual tables. If we are new to Athena, before we can run our queries, we should set up a query result location in Amazon S3. We clicked on the Run advanced queries in Amazon Athena option from within the CloudTrail dashboard and AWS created an Athena table. Then, we went to Athena and ran a preview query. We modified the query and executed it. Finally, we exported the results into a CSV file using an icon from the results screen.
After, we ran the SELECT * FROM "default"."cloudtrail_logs_aws_sec_cb_trail" limit 2; query. In this query, the "default"."cloudtrail_logs_aws_sec_cb_trail" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access