1

Let's say I have log group /aws/lambda/backend, which tracks logs of my Python lambda function. I want to debug common issues, like exceptions and time outs, and find related log entries.

But the function has a lot of concurrent traffic, so there are many log streams in the log group. How do I find the log entries across all logs without visiting each individual log stream and perform the search?

Oleksii Donoha
  • 2,911
  • 10
  • 22

1 Answers1

5

This is possible by using Logs Insights, which uses a query language to analyze logs in a log group.

For common Python function errors, I find this query useful:

fields @timestamp, @message, @logStream
| filter @message like /(?i)Exception|Error|Traceback|Timed out/
| sort @timestamp desc
| limit 20

This will return log queries and links to log groups to places, where exceptions or timeouts happened.

Oleksii Donoha
  • 2,911
  • 10
  • 22