Splunk Search

How do I sort this stats count?

bayman
Path Finder

This is my search below. It shows Country and count. How do I sort the count field for largest to smallest?

index="cisco_asa" src_ip="*" dest_port="*" action="blocked" | fields src_ip | iplocation src_ip | stats count by Country

kmorris_splunk
Splunk Employee
Splunk Employee

Add the following to the end of your search:

your search....| sort -count

woodcock
Esteemed Legend

Because there are fewer than 1000 Countries, this will work just fine but the default for sort is equivalent to sort 1000 so EVERYONE should ALWAYS be in the habit of using sort 0 (unlimited) instead, as in sort 0 - count or your results will be silently truncated to the first 1000.

DavidHourani
Super Champion

Just an update, default is now 10000 now 1000

dstaulcu
Builder

This is one of the most common gotchas I see among our users. Sure wish splunk would add some sort of tool tip or notification when such limits kick in.

santiagoaloi
Path Finder

that's a good one to keep in mind!

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...