I can view the log using the following command.
aws logs get-log-events --log-group-name groupName --log-stream-name streamName --limit 100
what is the command to get feature like tail -f
so that i can see the log real time
I was really disappointed with awslogs
and cwtail
so I made my own tool called Saw that efficiently streams CloudWatch logs to the console (and colorizes the JSON output):
You can install it on MacOS with:
brew tap TylerBrock/saw
brew install saw
It has a bunch of nice features like the ability to automatically expand (indent) the JSON output (try running the tool with --expand
):
saw watch my_log_group --expand
Got a Lambda you want to see error logs for? No Problem:
saw watch /aws/lambda/my_func --filter error
Saw is great because the output is easily readable and you can stream logs from entire log group, not just a single stream in the group. Filtering and watching streams with a certain prefix is also just as easy!