Splunk Search

How to get 2 unique rows for the values in the list.

angersleek
Path Finder

I have the following query: 

 

application_id=12345 STATUS_CODE IN (300, 400, 500)| head 10

 

How can I modify this such that I can get 2 unique rows where STATUS_CODE is 300, 2 unique rows where STATUS_CODE is 400, 2 unique rows where STATUS_CODE is 500 and so on? 

Above query ends up fetching 10 rows of the first ones it can find thus end up with all 10 rows as STATUS_CODE as 300 in correctly.

Pls advice. Thanks.  

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The dedup command will keep the first n events with unique field values.

index=foo application_id=12345 STATUS_CODE IN (300, 400, 500)
| dedup 2 STATUS_CODE

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

The dedup command will keep the first n events with unique field values.

index=foo application_id=12345 STATUS_CODE IN (300, 400, 500)
| dedup 2 STATUS_CODE

 

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...