Splunk Search

How to get a distinct count of only unique values of a field

summitsplunk
Communicator

So I'm trying to get a distinct count of source mac addresses by device.

The srcmac gives me the mac address
The devtype gives me the type of device like Windows, Mac, Android etc.

When I run the search below it gives a count of all events, it looks like where there's both a srcmac and a devtype.

The problem is I only want to know the count of unique values for srcmac, so only unique mac addresses in this case.
How would I go about reformatting the search below to do this?

| stats dc(srcmac) by devtype
0 Karma

MuS
SplunkTrust
SplunkTrust

Hi summitsplunk,

just try this:

 | stats dc(srcmac)

this will give you a distinct count of srcmac

Hope this helps ...

cheers, MuS

Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...