Splunk Search

How to get distinct values of one field by another field

sridamg
Explorer

the below search will give me distinct count of one field by another field

some search | stats dc(field1) by field2

but how would I get the distinct values for field1 by field2

so i want something like below:

some search | stats distinct(field1) by field2

Tags (3)
0 Karma

pradeepkumarg
Influencer

Check if this helps..

... | dedup field1, field2 | stats list(field1) by field2

MuS
Legend

Hi sridamg,

try something like this:

some search | stats values(field1) by field2

see the docs for more information http://docs.splunk.com/Documentation/Splunk/6.1.3/SearchReference/CommonStatsFunctions

cheers, MuS

Get Updates on the Splunk Community!

Developer Spotlight with Brett Adams

In our third Spotlight feature, we're excited to shine a light on Brett—a Splunk consultant, innovative ...

Index This | What can you do to make 55,555 equal 500?

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

Say goodbye to manually analyzing phishing and malware threats with Splunk Attack ...

In today’s evolving threat landscape, we understand you’re constantly bombarded with phishing and malware ...