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!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...