Splunk Search

How to edit my search to find multiple averages from one field based based on the context provided by other fields?

matthewjohnson
Explorer

When working with Windows performance counters, the Value field contains the interesting data for a given context. The context of Value is defined by other fields - the counter field for example.

What I'd like to do is something like this:

index="perfmon" collection="Free Disk Space" | stats avg(Value when counter == "% Free Space") as percent_free avg(Value when counter == "Free Megabytes") as mb_free by host

So I end up with something like this:

Host            | percent_free              | mb_free
--------------------------------------------------------
BigHost1        | 20                        | 3000
BigHost2        | 10                        | 1500
...

How do I accomplish this?

Tags (2)
0 Karma
1 Solution

somesoni2
Revered Legend

Try something like this

index="perfmon" collection="Free Disk Space" counter="% Free Space" OR counter="Free Megabytes" | chart avg(Value) over host by counter | rename "% Free Space" as percent_free "Free Megabytes" as mb_free

View solution in original post

somesoni2
Revered Legend

Try something like this

index="perfmon" collection="Free Disk Space" counter="% Free Space" OR counter="Free Megabytes" | chart avg(Value) over host by counter | rename "% Free Space" as percent_free "Free Megabytes" as mb_free

matthewjohnson
Explorer

Exactly what I wanted - thank you!

0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...