cryanbhu
cryanbhu

Reputation: 5254

AWS CloudWatch Logs filter expression for AND

I read the docs which explains:
"The filter pattern "ERROR Exception" matches log event messages that contain both terms, such as the following:
[ERROR] Caught IllegalArgumentException
[ERROR] Unhandled Exception"

Which doesn't really explain how to do an AND in the filter expression.

OR is fine, I simply do a ?ERROR ?CRITICAL
and i get my logs which are ERROR or CRITICAL level.

Upvotes: 1

Views: 1563

Answers (1)

Daniel Vassallo
Daniel Vassallo

Reputation: 344311

The AND is implicit and the default. When you search for: ERROR Exception, both terms ERROR and Exception must appear in the log event message for the filter to match. If you want to search for an exact phrase, you can wrap the phrase in double quotes. For example: "Something bad happened" will only match log events where that exact phrase appears.

Upvotes: 1

Related Questions