I have some metrics that are being published to CloudWatch logs. (It would probably be better as CloudWatch metrics)
Basic Query:
fields @timestamp, jvm.threads.live, process.cpu.usage, server , system.load.average.1m , jvm.memory.usage.after.gc
| sort by @timestamp desc
Sample data json:
{
"@timestamp": "2022-xx-xxT11:03:00.027Z",
"jvm.gc.overhead": "0",
"jvm.memory.usage.after.gc": "0.036",
"jvm.threads.live": "47",
"process.cpu.usage": "1",
"server": "MyServer.localdomain",
"system.load.average.1m": "2.351"
}
I can draw a graph using the below, but it does not take the server
into account and it just averages all servers.
The server names are random, so I don't have a list of them upfront.
fields @timestamp, jvm.threads.live, process.cpu.usage, server , system.load.average.1m , jvm.memory.usage.after.gc
| stats avg(jvm.threads.live) as threads, avg(process.cpu.usage * 100) as cpuPercentage, avg(system.load.average.1m) as loadAvg, avg(jvm.memory.usage.after.gc * 100) as memoryPercentage by bin(1m)
How do I show each server's stats and not just an average of all servers as below?
CodePudding user response:
this may work
fields @timestamp, jvm.threads.live, process.cpu.usage, server , system.load.average.1m , jvm.memory.usage.after.gc
| stats avg(jvm.threads.live) as threads, avg(process.cpu.usage * 100) as cpuPercentage, avg(system.load.average.1m) as loadAvg, avg(jvm.memory.usage.after.gc * 100) as memoryPercentage by server, bin(1m)