4

I want to create a line chart with two lines in AWS CloudWatch Logs Insights. One line representing mobile users and the other desktop users, showing a success rate for each group of users.

This this is the code I am working with:

| fields
    properties.device as device,
    properties.success as success
| stats avg(success) by device, bin(1hour)

The results of this query look promising. As you can see, the results include the device type, a timestamp, and the floating-point number to be plotted on the line chart:

#  device   bin(1hour)               avg(success)
1  desktop  2023-02-01T10:00:00.000  0.6129
2  mobile   2023-02-01T10:00:00.000  0.7453
3  desktop  2023-02-01T09:00:00.000  0.5578
4  mobile   2023-02-01T09:00:00.000  0.6082

However, the Visualization tab shows me this error:

The data is not suitable for a line chart.
Try a bar chart, or group your result by bin function.

I think Logs Insights is getting confused by my overlapping timestamps. It does not know that I intend one time series of mobile data and another of desktop data. To group by a field and bin by time, I seem to be doing the standard thing using a single by operation with two arguments. But it's not good enough to create a line chart.

Is there a better way to structure my query to convince CloudWatch of what I am trying to do?

John Skiles Skinner
  • 1,611
  • 1
  • 8
  • 21

0 Answers0