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!

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 ...