Splunk Search

How do I get top values based on eval?

jackpal
Path Finder

I have a relatively simple query with which I am evaluating a new field. I'd like to get the top values of this new field however the results are not what I expect:

Base Query:
index=lisum_data vendord=*  user_hash=* featurename=*  
| stats count by user_hash
| eval TimeUsed=count*10/60
| where TimeUsed > .5
| sort TimeUsed desc
| fields - count

Attempted:
index=lisum_data vendord=*  user_hash=* featurename=*  
| stats count by user_hash
| eval TimeUsed=count*10/60
| where TimeUsed > .5
| sort TimeUsed desc
| fields - count
| top limit=25 TimeUsed

I want a table of the top 25 users (user_hash) by total time used(TimeUsed)

0 Karma

KailA
Contributor

Hey !
You were really closed, try that :

index=lisum_data vendord=*  user_hash=* featurename=*  
 | stats count by user_hash
 | eval TimeUsed=count*10/60
 | where TimeUsed > .5
 | sort 25 -TimeUsed
 | fields - count

Let me know 🙂

Kail

0 Karma

Vijeta
Influencer

Your sort command should be sort 0 - TimeUsed

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

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 in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...