Hi! Thank you for using this template. Could you let us know which region you’re running in? If it’s not us-east-1, you may need to go into Athena and modify the DDL of the CloudTrail table to include all regions. Here’s the updated DDL: CREATE EXTERNAL TABLE cloudtrail_logs_pp_all_regions
(
eventversion
string COMMENT ‘from deserializer’,
useridentity
struct<type:string,principalid:string,arn:string,accountid:string,invokedby:string,accesskeyid:string,username:string,sessioncontext:struct<attributes:structmfaauthenticated:string,creationdate:string,sessionissuer:structtype:string,principalid:string,arn:string,accountid:string,username:string>> COMMENT ‘from deserializer’,
eventtime
string COMMENT ‘from deserializer’,
eventsource
string COMMENT ‘from deserializer’,
eventname
string COMMENT ‘from deserializer’,
awsregion
string COMMENT ‘from deserializer’,
sourceipaddress
string COMMENT ‘from deserializer’,
useragent
string COMMENT ‘from deserializer’,
errorcode
string COMMENT ‘from deserializer’,
errormessage
string COMMENT ‘from deserializer’,
requestparameters
string COMMENT ‘from deserializer’,
responseelements
string COMMENT ‘from deserializer’,
additionaleventdata
string COMMENT ‘from deserializer’,
requestid
string COMMENT ‘from deserializer’,
eventid
string COMMENT ‘from deserializer’,
resources
array<structarn:string,accountid:string,type:string> COMMENT ‘from deserializer’,
eventtype
string COMMENT ‘from deserializer’,
apiversion
string COMMENT ‘from deserializer’,
readonly
string COMMENT ‘from deserializer’,
recipientaccountid
string COMMENT ‘from deserializer’,
serviceeventdetails
string COMMENT ‘from deserializer’,
sharedeventid
string COMMENT ‘from deserializer’,
vpcendpointid
string COMMENT ‘from deserializer’)
PARTITIONED BY (
region
string COMMENT ‘AWS region’,
timestamp
string COMMENT ‘timestamp’
)
ROW FORMAT SERDE
‘com.amazon.emr.hive.serde.CloudTrailSerde’
STORED AS INPUTFORMAT
‘com.amazon.emr.cloudtrail.CloudTrailInputFormat’
OUTPUTFORMAT
‘org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat’
LOCATION
‘s3://cloudtrail-awslogs-889399602426-frf8blhu-isengard-do-not-delete/AWSLogs/889399602426/CloudTrail/’
TBLPROPERTIES (
‘classification’=‘cloudtrail’,
‘projection.enabled’=‘true’,
‘projection.region.type’=‘enum’,
‘projection.region.values’=‘us-east-1,us-east-2,us-west-1,us-west-2,eu-west-1,eu-central-1,ap-southeast-1,ap-southeast-2,ap-northeast-1,ap-northeast-2,sa-east-1’, – add regions as you need
‘projection.timestamp.type’=‘date’,
‘projection.timestamp.format’=‘yyyy/MM/dd’,
‘projection.timestamp.range’=‘2022/08/01,NOW’,
‘projection.timestamp.interval’=‘1’,
‘projection.timestamp.interval.unit’=‘DAYS’,
‘storage.location.template’=‘s3://cloudtrail-awslogs-889399602426-frf8blhu-isengard-do-not-delete/AWSLogs/889399602426/CloudTrail/${region}/${timestamp}’
)