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!

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