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
Legend

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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...