aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

AWS CLI CloudTrail Events Results -> EventTime timestamp format changed from Unix/ epoch timestamp to other timetamp format

Open benishue opened this issue 6 years ago • 6 comments

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug The timestamp format for the field (EventTime) in the CloudTrail lookup-events result in the documentation is Unix epoch format

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudtrail/lookup-events.html#examples

aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=ConsoleLogin Output:

{ "Events": [ { "EventId": "654ccbc0-ba0d-486a-9076-dbf7274677a7", "Username": "my-session-name", "EventTime": 1453844532.0,

See image below While running the same command using the AWS CLI, the format of this field is different

[bla@bla bla ~]# aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=ConsoleLogin { "Events": [ { "EventId": "bla-bla-bla", "EventName": "ConsoleLogin", "ReadOnly": "false", "EventTime": "2020-06-09T12:57:37+02:00", "EventSource": "bla.amazonaws.com", "Username": "[email protected]", "Resources": [], ...

See image below SDK version number aws-cli/2.0.17 Python/3.7.3 Linux/3.10.0-1062.4.1.el7.x86_64 botocore/2.0.0dev21

Platform/OS/Hardware/Device What are you running the cli on? CentOs 7

To Reproduce (observed behavior) Steps to reproduce the behavior Run the following command from the AWS CLI documentation; aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=ConsoleLogin

Expected behavior To get the same timestamp format for the field

Logs/output Get full traceback and error logs by adding --debug to the command.

Additional context Add any other context about the problem here. image

v.s.

image

benishue avatar Jun 09 '20 17:06 benishue

Hi @benishue, thanks for the report. I can confirm running this command with aws-cli/2.0.21 that I see a time format like:

"EventTime": "2020-06-17T12:04:36-07:00",

Labeling this as a documentation issue.

kdaily avatar Jun 17 '20 19:06 kdaily

Greetings! It looks like this issue hasn’t been active in longer than one year. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

github-actions[bot] avatar Oct 01 '21 21:10 github-actions[bot]

Hi @benishue, thanks for bringing this to our attention. In the CloudTrail documentation it says EventTime has a Timestamp type, but the CLI serializes fields modeled as Timestamp to datetime objects. I'll create a PR to update that example in our documentation.

tim-finnigan avatar Nov 18 '21 20:11 tim-finnigan

Created this PR: https://github.com/aws/aws-cli/pull/6555

tim-finnigan avatar Nov 18 '21 20:11 tim-finnigan

Closing this as PR was merged.

tim-finnigan avatar Nov 18 '21 21:11 tim-finnigan

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Nov 18 '21 21:11 github-actions[bot]