Amazon CloudWatch export log data to Amazon S3 is either missing or invalid? We can help you.
Recently one of our customers went ahead with the configuration of Amazon CloudWatch to export log data to Amazon S3.
He did it as said in the user guide using the AWS CLI. However, despite completing the steps, he couldn’t locate any useful log file data at the specified Amazon S3 destination.
Here, at Bobcares, we assist our customers with several AWS queries as part of our AWS Support Services.
Today, let us see what we need to do in such a scenario.
CloudWatch Export Log Data to S3 is Invalid
Generally, we come across this error because we must specify the time interval for the log data. This should do this using time stamps expressed as the number of milliseconds that have elapsed since Jan 1, 1970 00:00:00 UTC.
Failure of which will lead us to the error.
Moving ahead, let us see how our Support Techs go about fixing this issue.
To fix this, we need to retrieve CloudWatch log data from Amazon S3. We specify 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, we run:
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"
[Failed to resolve the issue? We are available 24*7]
Conclusion
To conclude, we come across this error, when we fail to specify the time interval for the log data using time stamps. Here, we saw how our Support Techs fix this for our customers.
0 Comments