Last active
August 23, 2023 10:28
-
-
Save alsmola/db87d3ab1ade8e88da52650e719897c5 to your computer and use it in GitHub Desktop.
cloudtrail_partition_create_athena_table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE EXTERNAL TABLE cloudtrail_logs ( | |
eventversion STRING, | |
userIdentity STRUCT< | |
type:STRING, | |
principalid:STRING, | |
arn:STRING, | |
accountid:STRING, | |
invokedby:STRING, | |
accesskeyid:STRING, | |
userName:STRING, | |
sessioncontext:STRUCT< | |
attributes:STRUCT< | |
mfaauthenticated:STRING, | |
creationdate:STRING>, | |
sessionIssuer:STRUCT< | |
type:STRING, | |
principalId:STRING, | |
arn:STRING, | |
accountId:STRING, | |
userName:STRING>>>, | |
eventTime STRING, | |
eventSource STRING, | |
eventName STRING, | |
awsRegion STRING, | |
sourceIpAddress STRING, | |
userAgent STRING, | |
errorCode STRING, | |
errorMessage STRING, | |
requestParameters STRING, | |
responseElements STRING, | |
additionalEventData STRING, | |
requestId STRING, | |
eventId STRING, | |
resources ARRAY<STRUCT<ARN:STRING,accountId: STRING,type:STRING>>, | |
eventType STRING, | |
apiVersion STRING, | |
readOnly STRING, | |
recipientAccountId STRING, | |
serviceEventDetails STRING, | |
sharedEventID STRING, | |
vpcEndpointId STRING | |
) | |
PARTITIONED BY (region string, year string, month string, day string) | |
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://CLOUDTRAILBUCKET/AWSLogs/ACCOUNTNUMNBER/'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment