我正在使用 Amazon Athena 获取过去一周发生的所有控制台登录,现在无论数据如何,我都能够获取所有控制台登录。我需要修改以下查询,以便该查询始终获取上周发生的所有 aws 控制台登录。
WITH events AS (
SELECT
event.eventVersion,
event.eventID,
event.eventTime,
event.eventName,
event.eventType,
event.eventSource,
event.awsRegion,
event.sourceIPAddress,
event.userAgent,
event.userIdentity.type AS userType,
event.userIdentity.arn AS userArn,
event.userIdentity.principalId as userPrincipalId,
event.userIdentity.accountId as userAccountId,
event.userIdentity.userName as userName
FROM cloudtrail.events
CROSS JOIN UNNEST (Records) AS r (event)
)
SELECT userName,sourceIPAddress,eventName,eventTime FROM events WHERE eventName='ConsoleLogin';
吨