Getting Data In

Break script output into top values on multi value keys

scalexan62
Engager

I have a script that produces output like the following:

foo=abc, bar=efg, size=100
foo=abc, bar=kkk, size=102
foo=cba, bar=fff, size=110
foo=cba, bar=ppp, size=90
foo=aaa, bar=bbb, size=95

I like to now get a chart showing the top values something like this:

foo/bar                size
-------                ----
cba/fff                110
abc/kkk                102
abc/efg                100
aaa/bbb                 95
cba/ppp                 90

Any suggestions. Do I need to break this up into separate events?

Tags (1)
0 Karma

sbrant_tt
Explorer

I think this will work for you:

 | multikv noheader=t | rex field=Column_1 "foo=(?<foo>.*)" | rex field=Column_2 "bar=(?<bar>.*)" | rex field=Column_3 "size=(?<size>.*)" | eval "foo/bar"=foo."/".bar | top size by foo/bar showcount=f showperc=f
Get Updates on the Splunk Community!

Leveraging Detections from the Splunk Threat Research Team & Cisco Talos

  Now On Demand  Stay ahead of today’s evolving threats with the combined power of the Splunk Threat Research ...

New in Splunk Observability Cloud: Automated Archiving for Unused Metrics

Automated Archival is a new capability within Metrics Management; which is a robust usage & cost optimization ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...