All Apps and Add-ons

Query to Find the Value in a Field Just One Time

JaysonD123
Explorer

Good Afternoon,

I am trying to figure out a way to iterate through a list whenever the value is counted one time. I'm hoping it'll make mq so that way my query is speedier. Here's my current query:

index=* eventtype IN(valueA,valueB,valueC) | stats count by eventtype

and the result looks like this:

eventtype                               count

valueA                                        102

valueB                                        407

valueC                                       1034

 

What I'd like is a query where if the query finds the value in the field one time, move on to find the next value. This is how I want the output to look like:

eventtype                               count

valueA                                        1

valueB                                        1

valueC                                       1

 

Any help would be appreciated.

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
index=* eventtype IN(valueA,valueB,valueC) | dedup eventtype | stats count by eventtype

View solution in original post

JaysonD123
Explorer

This is close to what I was looking for. Thank you!

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
index=* eventtype IN(valueA,valueB,valueC) | dedup eventtype | stats count by eventtype
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...