CLI Package to fetch CloudWatch logs and format them with human readable datetimes
- Download all files in this gist
- Run
$ yarn
- Run
$ chmod +x ./get-logs.sh
- Install AWS CLI
- Log in to AWS CLI by runnin
aws configure
The bash script was written to be run from terminal with the following parameters:
./get-logs.sh <log-group-name> <log-stream-name> <epoch-time-integer> <output-file>
Example:
./get-logs.sh /ecs/group dev-group-ecs-instance/dev-group-ecs-instance/a77f726e-938a-4c5b-894a-fb3df7e5d98b 1565100257000 my-output-log.txt
You can get the start time string from CloudWatch url, for example 2019-08-06T14:04:17Z
, then simply go to momentjs.com and run this from chrome dev tools:
moment('2019-08-06T14:04:17Z').valueOf()