Splunk Search

How to edit my search to only show top 5 IPs by Office?

rus7am
Explorer

Hello,

We have this search below:

stats count(eval(State="OPEN")) as "Open", count(eval(State="CLOSED")) as "Closed" by Office, City, IP  | sort City, Office, -Open

And results in this table:

City Office IP Open Closed
City1 Office1 IP1 30
City1 Office1 IP2 18
City1 Office1 IP3 10
City1 Office1 IP4 5
City1 Office1 IP5 4
City1 Office1 IP6 1
City1 Office1 IP7 1
City1 Office2 IP1 30
City1 Office2 IP2 28
City1 Office2 IP3 20
City1 Office2 IP4 19
City1 Office2 IP5 18
City1 Office2 IP6 17
City1 Office2 IP7 10
City1 Office2 IP8 1

Is it possible to limit it to display only the top 5 IPs by Office?

City Office IP Open Closed
City1 Office1 IP1 30
City1 Office1 IP2 18
City1 Office1 IP3 10
City1 Office1 IP4 5
City1 Office1 IP5 4
City1 Office2 IP1 30
City1 Office2 IP2 28
City1 Office2 IP3 20
City1 Office2 IP4 19
City1 Office2 IP5 18
City2 Office1 ...

Tags (3)
0 Karma

jtrucks
Splunk Employee
Splunk Employee

Use top:

... |top limit=5 IP by Office
--
Jesse Trucks
Minister of Magic

rus7am
Explorer

Top removes City and Open columns. And Top does not use values in Open column.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...