Published on

How to export existing log data from CloudWatch Logs to a file

Tired of using AWS Console? 🤕
Time to boost your productivity with Cloudash — an AWS desktop client.

As usual in such cases - AWS Command Line Interface comes to the rescue. If you don't have it installed, follow the instructions here, followed by configuration setup here.

Once you have the CLI installed and configured, you can use the following command to export the log data to a file:

aws logs get-log-events --log-group-name <log-group-name> --log-stream-name <log-stream-name> --output text --query 'events[*].message' > <output-file-name>

Note that you may choose to omit the --query parameter if you want to export the entire log event, including the timestamp and other metadata. At the time of writing this command is limited to return a maximum of 1MB of data, but that should be more than enough for a nice, cozy evening read. You may also give an open source awslogs project a shot.

Tired of switching between AWS console tabs? 😒

Cloudash provides clear access to CloudWatch logs and metrics, to help you make quicker decisions.
Try it for free:

Logs screen