I configured Amazon CloudWatch to export log data to Amazon Simple Storage Service (Amazon S3), as described at Export Log Data to Amazon S3 Using the AWS CLI. But despite completing these steps, I can't locate any useful log file data at the specified Amazon S3 destination. What do I need to do?

This issue typically occurs because you must specify the time interval for the log data using time stamps expressed as the number of milliseconds that have elapsed since Jan 1, 1970 00:00:00 UTC. 

Retrieve CloudWatch log data from Amazon S3 by specifying the time interval for the log data using starting and ending time stamps that are expressed in milliseconds.

For example, to retrieve CloudWatch log data exported to an Amazon S3 bucket or folder for the previous two-hour period, use the following syntax:

aws logs create-export-task --task-name "example-task" --log-group-name "/var/logs/example-logs" --from $(($(date -d "-2 hours" +%s%N)/1000000)) --to $(($(date +%s%N)/1000000)) --destination " log_bucket" --destination-prefix "example-logs"

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2016-02-30

Updated: 2018-09-18