Published on

How to filter CloudWatch Logs Insights by a given string

Authors
Tired of constantly switching between AWS Console tabs? 🤕
Time to boost your productivity with Cloudash — an AWS desktop client.

The best way to filter CloudWatch Logs Insights by a given string is to use the filter command combined with a regular expression, like this:

fields @timestamp, @message
| filter @message like /your filter goes here/
| sort @timestamp desc
| limit 20

Make sure to always add a limit clause to your query, otherwise you might end up with a huge amount of data. Not only you most likely don't need to see 100k entries, you may also incur additional costs - consult the Amazon CloudWatch pricing page for more details.

Tired of switching between AWS console tabs? 😒

Cloudash provides a laser-focused view of your AWS API Gateway, Lambda and other resources - all in a single app.

Logs screen