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!

Reduce and Transform Your Firewall Data with Splunk Data Management

Managing high-volume firewall data has always been a challenge. Noisy events and verbose traffic logs often ...

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...