Search code examples
amazon-web-servicesamazon-cloudwatch

Two metric filters for the same metric


I have created a MetricFilter that creates a metric depending whether there are specific values in the user-agent string and writes TestAccount=0 or TestAccount=1 depending. I also want to a filter that checks if the accountId in the request matches one from a list of accountId and write the same metric TestAccount. I am not including the filters for the accounts in the same MetricFilter because the list will exceed the maximum length of a MetricFilter's FilterPattern.

If there is a request where one MetricFilter evaluates to 0 and another evaluates to 1, what is the consequence of this approach? Will the first or last one win or will the MetricFilter that evaluates to 1 win?


Solution

  • Both the 0 value and 1 value is ingested by CloudWatch and data from both filters is aggregated together. Max value of the metric will be 1 and min will be 0. Sample count will be double compared to having only 1 metric filter.