Tail CloudWatch logs

Watch a Lambda's logs live, from the terminal, like tail -f.

SNP 139 #369 Filed aws cmd

shell
aws logs tail /aws/lambda/my-function --follow

Add --since 1h to start an hour back (10m and 2d work too), and --format short to drop the stream names. Filter for errors only:

shell
aws logs tail /aws/lambda/my-function --follow --filter-pattern ERROR

Find the log group's name when you've forgotten it:

shell
aws logs describe-log-groups --query 'logGroups[].logGroupName' --output text

This replaced a lot of clicking around the console while I was debugging the Open Graph image Lambda.