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!

Modern way of developing distributed application using OTel

Recently, I had the opportunity to work on a complex microservice using Spring boot and Quarkus to develop a ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had 3 releases of new security content via the Enterprise Security ...

Archived Metrics Now Available for APAC and EMEA realms

We’re excited to announce the launch of Archived Metrics in Splunk Infrastructure Monitoring for our customers ...