I made a tool because the task of collecting logs from the CloudWatch Logs console is sober.
https://github.com/naomichi-y/cloudwatch-logs-downloader
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