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
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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...