AWS CloudWatch Insights Average

CloudWatch Logs Insights Query Syntax

Parsing the below log entry.

2021-03-02 00:04:29,532 INFO  [backendTaskScheduler-2] control.NodeHealthMonitor - 1609@ip-10-0-1-104#vFR NodeHealth[updated=2021-03-02T00:04:29.532, host='10.0.1.104', pid='1609', maxMemory=12884901886, usedMemory=418226480, usedMemoryOneHourMax=421286304, usedMemoryOneDayMax=427718856, member='[uuid:ab992f4b-305e-4100-8bf7-390168f5dd30,port:5701,lite:false]', mode=AS_SERVER, joined=2021-03-01T16:49:04.346, left=null, state=READY]

The below will plot the average used memory and output a line graph visualisation.

parse @message "usedMemory=*," as usedmem
| stats avg(usedmem) by bin(5m)

The below will output the average used memory as a single figure only.

parse @message "usedMemory=*," as usedmem
| avg(usedmem)

About

I'm a technology professional who's been passionate about computers since my Grandad introduced me to an Intel 386 back in the 90s when I was a kid. Those moments inspired a passion within for technology, and I've been playing around with anything with a circuit board ever since. Whenever I have a moment you can probably find me working on something computer-related, and this is where I like to write about those moments.