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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...