Splunk Search

How do I sort this stats count?

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

Splunk Employee
Splunk Employee

Add the following to the end of your search:

your search....| sort -count

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.

Super Champion

Just an update, default is now 10000 now 1000

0 Karma


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.

0 Karma

Path Finder

that's a good one to keep in mind!

Get Updates on the Splunk Community!

Improve Your Security Posture

Watch NowImprove Your Security PostureCustomers are at the center of everything we do at Splunk and security ...

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...