Splunk Search

Sort and display top 5 values alone

sushmitha_mj
Communicator

I am trying to display the top 5 memory used values by command - Meaning the top 5 commands with maximum usage, but I seem to be unable to get the output. Here is my search:

index=os sourcetype=ps host=xyz  | eval RSZ_MB=RSZ_KB/1024| stats max(RSZ_MB) as "Memory_Used" by COMMAND | sort -Memory_Used | top 5

Thanks,
Sushmitha

Tags (3)
0 Karma
1 Solution

NOUMSSI
Builder

hi try this:

index=os sourcetype=ps host=xyz | eval RSZ_MB=RSZ_KB/1024| stats max(RSZ_MB) as "Memory_Used" by COMMAND | sort -Memory_Used | top limit=5 Memory_Used

View solution in original post

NOUMSSI
Builder

hi try this:

index=os sourcetype=ps host=xyz | eval RSZ_MB=RSZ_KB/1024| stats max(RSZ_MB) as "Memory_Used" by COMMAND | sort -Memory_Used | top limit=5 Memory_Used

sushmitha_mj
Communicator

Worked... Thanks...

0 Karma

NOUMSSI
Builder

Excellent! Please vote if the answer was helpful.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...