'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 1:[1]

Not able to group by a certain field and create visualizations.

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

Keep getting this message

No visualization available. Try this to get started:
stats count() by bin(30s)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sabarish