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
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...