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!

Announcing Scheduled Export GA for Dashboard Studio

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

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...