Splunk Search

Help with making stats table in decreasing order

jialiu907
Path Finder

I am looking for the table to be in decreasing order and with the Total row on top. 

This is my current search. 

index=jia source="/hptc_cluster/splunk/Reports/PBS/splunkresults.csv" host="gridmetrics" sourcetype="JiaGridMetrics"
| stats count as Slots by JobName
| rename Slots as CPU
| addcoltotals label=Total labelfield=JobName
| sort count desc

This is the output.

jialiu907_0-1685026069032.png

 

Labels (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

You're asking the sort command to sort on a field that doesn't exist (count).  Choose either CPU or JobName for the sort.

index=jia source="/hptc_cluster/splunk/Reports/PBS/splunkresults.csv" host="gridmetrics" sourcetype="JiaGridMetrics"
| stats count as CPU by JobName
| addcoltotals label=Total labelfield=JobName
| sort - CPU

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

You're asking the sort command to sort on a field that doesn't exist (count).  Choose either CPU or JobName for the sort.

index=jia source="/hptc_cluster/splunk/Reports/PBS/splunkresults.csv" host="gridmetrics" sourcetype="JiaGridMetrics"
| stats count as CPU by JobName
| addcoltotals label=Total labelfield=JobName
| sort - CPU

 

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...