I would like to visualise event occurrence changes in time.
Use case:
What I'm aware of:
fields @timestamp, eventName | stats count() by bin(1h), eventName | sort bin(1h) asc
fields @timestamp, eventName | stats count() by bin(1h), eventName | sort bin(1h) asc
eventName
field form display
I get a log-table with the correct data, but the line graph is showing datapoints mixed (eg: dataA1, dataA2, dataB3, dataA4, dataB5)The question:
See https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_Insights-Visualizing-Log-Data.html
Visualizing time series data Time series visualizations work for queries with the following characteristics: The query contains one or more aggregation functions. For more information, see Aggregation Functions in the Stats Command. The query uses the bin() function to group the data by one field. These queries can produce line charts, stacked area charts, bar charts, and pie charts.
You can't use line chart for your example because you can only use single bin() grouping to produce time series. You can however use eg pie chart for your use case.
Alternatively if applicable to your use case, you can start producing logs in different format as
{
"eventA": 1,
"eventB": 0
}
Then you can write query as stats sum(eventA), sum(eventB) by bin(1h)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.