2

I'm trying to set up a CloudWatch graph using SEARCH, I've done some before, but I can't get it to work the way I want this time. My issue is that I want to include only some of the metric dimensions in the graph. I can search just the namespace and metric, like this:

SEARCH('Namespace="MyServiceName" MetricName="LatencyFromCreation"', 'Average', 300)

That aggregates, but that doesn't give me any dimensions. I can include all the dimensions this:

SEARCH('{MyServiceName,ResultState,ItemType,LogGroup,ServiceName,ServiceType} LatencyFromCreation', 'Average', 300)

That doesn't do any aggregation, it shows me every combination of dimensions. But when I try to remove some of them (as described in the docs and shown in examples) to keep only the dimensions that I'm interested in, like this:

SEARCH('{MyServiceName,ItemType} LatencyFromCreation', 'Average', 300)

I get no results, even though the docs seem to make it clear that this should work, am I missing something? Are the docs inaccurate?

I found this question which is related, but the answer that mentions using SEARCH does not make it clear if they are displaying a subset of the dimensions or not.

  • Checkout https://stackoverflow.com/questions/48443899/cloudwatch-does-not-aggregate-across-dimensions-for-your-custom-metrics – Ryan Williams Mar 03 '21 at 02:02

1 Answers1

1

I was able to find a solution by using CloudWatch Embedded Metrics Format (EMF) as the log format emitted by my services (as mentioned in this post that Ryan linked), combined with using Metric Filters to create new metrics from the EMF logs, in addition to the ones CloudWatch creates. This allowed me to choose exactly which dimensions I wanted included in the metric by adjusting the pattern on the filter. Then I was able to use all of the normal Metric Math goodness that CloudWatch provides on this new metric.

Feels pretty hacky, but it works.