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!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...