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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...