Splunk Search

Is there a good way to chart the value of a field by the value of another field?

shaun_qualheim
Explorer

Is there a good way to chart the value of a field by the value of another field?

That is... I'm using the Splunk for *nix app, performing a search on that data. Setting my source="cpu". Want to extract out pctIdle by CPU core. I can do it pretty easily for each individual core with something like this:

index=os source="cpu" host="host1" | multikv fields cpu | search CPU="1" |table pctIdle

but what I really want to do is have a multi column table with that value in real-time by cpu core (and eventually, a visualization by column).

Thank you for your help!

Tags (2)
0 Karma
1 Solution

alacercogitatus
SplunkTrust
SplunkTrust

If I'm thinking straight this morning, you would want to use stats.

index=os source="cpu" host="host1" | multikv fields cpu |stats latest(pctIdle) as "Percent Idle" by cpu

View solution in original post

alacercogitatus
SplunkTrust
SplunkTrust

If I'm thinking straight this morning, you would want to use stats.

index=os source="cpu" host="host1" | multikv fields cpu |stats latest(pctIdle) as "Percent Idle" by cpu

alacercogitatus
SplunkTrust
SplunkTrust

Glad it worked for you! Please accept the answer when you have time!

0 Karma

shaun_qualheim
Explorer

Perfect. Thank you much!

0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

After your pastebin, it seems as if the fields aren't auto extracted (at least in my instance). Try this: |multikv|rex field=_raw "^(?<cpu>\d+)\s*(?<pctUser>[^\s]*)\s*(?<pctNice>[^\s]*)\s*(?<pctSystem>[^\s]*)\s*(?<pctIowait>[^\s]*)\s*(?<pctIdle>[^\s]*)"|eval pctCPUUsed = 100-pctIdle| stats latest(pctCPUUsed) by cpu

shaun_qualheim
Explorer

It doesn't seem to be working, but maybe that's the right track. Let me play with it a bit and I'll post again...

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...