3

I want to visualize the memory usage of unique Lambda instances by plotting multi-line charts in Logs Insights.

I can access logStream ID in my Logs Insights query using @logStream

I'd like to be able to plot a line showing memory usage for each different logStream ID over time, something like this:

fields @timestamp, @logStream, @maxMemoryUsed
| filter @message like /REPORT/
| sort @timestamp desc
| stats @logStream, avg(@maxMemoryUsed) by bin(1m)

This produces a line showing average memory usage per minute, or a nice pie chart showing memory usage by LogStream per minute.

I'd like a chart which shows a line for each separate LogStream ID though.

Hardcoding in this case isn't an option as in the accepted answer to this question: How can I visualize timeseries data aggregated by more than one dimension on AWS insights?

The name of each line has to be assigned dynamically, as I can't control what the LogStream ID is, and I don't know how many there'll be for the time periods I'm interested in.

I also note that the docs https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html say that this is possible, but don't give an example of how.

justajolt
  • 141
  • 11

0 Answers0