totsubo
totsubo

Reputation: 373

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

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

Upvotes: 3

Views: 7632

Answers (1)

Ashish Chandra
Ashish Chandra

Reputation: 121

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

Upvotes: 3

Related Questions