<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to get a distinct count of only unique values of a field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-distinct-count-of-only-unique-values-of-a-field/m-p/439737#M125076</link>
    <description>&lt;P&gt;So I'm trying to get a distinct count of source mac addresses by device. &lt;/P&gt;

&lt;P&gt;The srcmac gives me the mac address&lt;BR /&gt;
The devtype gives me the type of device like Windows, Mac, Android etc. &lt;/P&gt;

&lt;P&gt;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. &lt;/P&gt;

&lt;P&gt;The problem is I only want to know the count of unique values for srcmac, so only unique mac addresses in this case. &lt;BR /&gt;
How would I go about reformatting the search below to do this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats dc(srcmac) by devtype
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 07 Aug 2019 22:12:44 GMT</pubDate>
    <dc:creator>summitsplunk</dc:creator>
    <dc:date>2019-08-07T22:12:44Z</dc:date>
    <item>
      <title>How to get a distinct count of only unique values of a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-distinct-count-of-only-unique-values-of-a-field/m-p/439737#M125076</link>
      <description>&lt;P&gt;So I'm trying to get a distinct count of source mac addresses by device. &lt;/P&gt;

&lt;P&gt;The srcmac gives me the mac address&lt;BR /&gt;
The devtype gives me the type of device like Windows, Mac, Android etc. &lt;/P&gt;

&lt;P&gt;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. &lt;/P&gt;

&lt;P&gt;The problem is I only want to know the count of unique values for srcmac, so only unique mac addresses in this case. &lt;BR /&gt;
How would I go about reformatting the search below to do this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats dc(srcmac) by devtype
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Aug 2019 22:12:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-distinct-count-of-only-unique-values-of-a-field/m-p/439737#M125076</guid>
      <dc:creator>summitsplunk</dc:creator>
      <dc:date>2019-08-07T22:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a distinct count of only unique values of a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-distinct-count-of-only-unique-values-of-a-field/m-p/439738#M125077</link>
      <description>&lt;P&gt;Hi summitsplunk,&lt;/P&gt;

&lt;P&gt;just try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | stats dc(srcmac)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this will give you a distinct count of &lt;CODE&gt;srcmac&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 22:17:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-distinct-count-of-only-unique-values-of-a-field/m-p/439738#M125077</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-08-07T22:17:04Z</dc:date>
    </item>
  </channel>
</rss>

