I'm just trying to create an alarm based on CloudWatch Logs Filter which triggers on multiple terms (or connected, not and) and is case insensitive
Using "error warning" as pattern is not working
I'm looking for filter pattern reacting to all of the following errors and warnings:
ERROR: first sample
Error: second sample
error: third sample
{ ERROR: "fourth sample"}
{type: "error"}
WARNING: SOMETHING BAD!
{ WARNING: "fifth sample"}
Per the AWS Documentation concerning Filter and Pattern Syntax, you cannot use "error warning" to capture an "OR" relationship because:
Or in other words, CloudWatch Log metric filters expect an "AND" relationship.
Likewise:
So you'll be unable to achieve this with a single filter. You'll need a filter for each case-sensitive permutation of "error" and "warning" that you expect to write to Cloudwatch Logs.
In order to set a single alarm on all of these filters, simply configure each filter to use the same CloudWatch metric. Here's an example from the AWS Console where each of my metric filters are targeted towards my
LogMetric/testmetric:I can then simply create a CloudWatch alarm based on the
LogMetric/testmetric to alarm on the sum of these distinct metric filters.