Splunk Search

Top 10 values from 10 different columns?

Aakanksha
Path Finder

I want top 10 values from the below query:
Problem is , we have applied stats average on multiple column, so simply writing top 10 or head 10 won't work in this case. Sorting is also an issue in this case.

...
|stats avg(http_data) as "HTTP",avg(https_data) as "HTTPS",avg(rtsp_data) as "RTSP",avg(rtp_data) as "RTP",avg(wtp_data) as "WTP",avg(wsp_data) as "WSP",avg(mms_data) as "MMS",avg(sip_data) as "SIP",avg(ftp_data) as "FTP",avg(dns_data) as "DNS Lookups",avg(smtp_data) as "SMTP",avg(pop3_data) as "POP3",avg(imap_data) as "IMAP",avg(skype_data) as "SKYPE",avg(torrent_data) as "TORRENT",avg(msn_data) as "MSN",avg(yahoo_data) as "YAHOO",avg(ddlink_data) as "DDLINK" ,avg(jabber_data) as "JABBER",avg(ppstream_data) as "PPSTREAM",avg(steam_data) as "STEAM",avg(imesh_data) as "IMESH",avg(hamachivpn_data) as "HAMACHIVPN",avg(mute_data) as "MUTE",avg(pando_data) as "PANDO",avg(orb_data) as "ORB",avg(winny_data) as "WINNY",avg(slingbox_data) as "SLINGEBOX",avg(fasttrack_data) as "FASTTRACK"

Tags (1)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

If you basically have one row and loads of columns you can transpose the result and then work with one column.

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

If you basically have one row and loads of columns you can transpose the result and then work with one column.

martin_mueller
SplunkTrust
SplunkTrust

Sort and head work perfectly, consider this as an example:

| gentimes start=-1 increment=5m | stats avg(starttime) as avg1 avg(endtime) as avg2 max(starttime) as max1 max(endtime) as max2 min(starttime) as min1 min(endtime) as min2 | transpose | sort - "row 1" | head 3
0 Karma

Aakanksha
Path Finder

No, this will not work.Transpose will categorize all values in one column but still TOP or SORT command won't work here, as there will be no column name and data is different.

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...