[GO] Download CloudWatch Logs logs to your local environment

Overview

I made a tool because the task of collecting logs from the CloudWatch Logs console is sober.

Source code

https://github.com/naomichi-y/cloudwatch-logs-downloader

Feature

How to use

To get the logs for December 27, 2020, 15:59 (UTC) in the log group ecs/production.

$ docker run --rm -it --env-file=.env -v ${PWD}:/go/src/app cld -group=ecs/production-log -start="2020-12-27 15:59:00" -end="2020-12-27 15:59:59"

2020/12/29 07:05:42 Write results...
2020/12/29 07:05:42 Generated log file: ./dist/result_2020122970533.log

$ cat ./dist/result_2020122970533.log
[
  {
    "IngestionTime": "2020-12-27 15:59:22 +0000 UTC",
    "LogStream": "app/app/5302adeb527b42a0acbb11ac3444d98f",
    "Message": "Foo",
    "Timestamp": "2020-12-27 15:59:21 +0000 UTC"
  },
  {
    "IngestionTime": "2020-12-27 15:59:22 +0000 UTC",
    "LogStream": "app/app/5302adeb527b42a0acbb11ac3444d98f",
    "Message": "Bar",
    "Timestamp": "2020-12-27 15:59:21 +0000 UTC"
  },
  {
    "IngestionTime": "2020-12-27 15:59:22 +0000 UTC",
    "LogStream": "app/app/5302adeb527b42a0acbb11ac3444d98f",
    "Message": "Baz",
    "Timestamp": "2020-12-27 15:59:21 +0000 UTC"
  },
  ...
]

Recommended Posts

Download CloudWatch Logs logs to your local environment
Build a LAMP environment on your local Docker
How to use jupyter lab in Windows 10 local environment
How to set up and compile your Cython environment
Output CloudWatch Logs to S3 with AWS Lambda (Pythyon ver)
Use mitmproxy to force your app's API into your development environment
[Python] Regularly export from CloudWatch Logs to S3 with Lambda