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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...