Published on

How to filter CloudWatch Logs Insights by a given string

Authors
Tired of using AWS Console? 🤕
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 clear access to CloudWatch logs and metrics, to help you make quicker decisions.
Try it for free:

Logs screen