Search code examples
amazon-cloudwatchaws-cloudwatch-log-insights

How to aggregate logs by field and then by bin in AWS CloudWatch Insights?


I'm trying to do a query that will first aggregate by field count and after by bin(1h) for example I would like to get the result like:

# Date                     Field Count
1 2019-01-01T10:00:00.000Z A     123
2 2019-01-01T11:00:00.000Z A     456
3 2019-01-01T10:00:00.000Z B     567
4 2019-01-01T11:00:00.000Z B     789

Not sure if it's possible though, the query should be something like:

fields Field
| stats count() by Field by bin(1h)

Any ideas how to achieve this?


Solution

  • Is this what you need?

    fields Field | stats count() by Field, bin(1h)