AWS Cloudwatch Insights: how to aggregate by count(*)

Viewed 1104

I like to get a distribution of how many calls to an external service my Lambda makes per request.

The query below works for short period (< 5 minutes):

fields @message
| filter @message like "Calling BambooGatewayClient LocationInfoApi"
| stats count(*) as cnt by @requestId
| sort cnt desc

But the output is a count per requestId. I thought of downloading the result for offline processing but .... over our busy period there are ~150k results (uniq requestId's). Running this over the whole day creates a result that is too large to download.

Is there a way to get Insights to aggregate by count?

enter image description here

1 Answers

Change

fields @message
| filter @message like "Calling BambooGatewayClient LocationInfoApi"
| stats count(*) as cnt by @requestId
| sort cnt desc

to

fields @message
| filter @message like "Calling BambooGatewayClient LocationInfoApi"
| stats count(*) as cnt
Related