<?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 Re: Display total count of unique values of a field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Display-total-count-of-unique-values-of-a-field/m-p/613366#M213168</link>
    <description>&lt;P&gt;Thanks, karma points awarded.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2022 08:27:56 GMT</pubDate>
    <dc:creator>neerajs_81</dc:creator>
    <dc:date>2022-09-16T08:27:56Z</dc:date>
    <item>
      <title>Display total count of unique values of a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-total-count-of-unique-values-of-a-field/m-p/613347#M213161</link>
      <description>&lt;P&gt;Hi,&amp;nbsp; &amp;nbsp;Fundamentals question but one of those brain teasers.&amp;nbsp; How do i get a total count of distinct values of a field ?&amp;nbsp; &amp;nbsp;For example, as shown below&amp;nbsp; Splunk shows my "aws_account_id" field has 100+ unique values.&amp;nbsp; &amp;nbsp;What is that exact 100+ number ?&amp;nbsp; If i hover my mouse on the field, it shows Top 10 values etc. but not the total count.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="neerajs_81_0-1663306844332.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21498i53A6833D98B129B4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="neerajs_81_0-1663306844332.png" alt="neerajs_81_0-1663306844332.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Things i have tried as per other posts in the forum"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=aws sourcetype="aws:cloudtrail" | fields aws_account_id 
| stats dc(count) by aws_account_id &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;BR /&gt;This does show me the total count (which is 156) but it shows like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="neerajs_81_1-1663306940766.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21499i74718BE605B381A4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="neerajs_81_1-1663306940766.png" alt="neerajs_81_1-1663306940766.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead i want the data in this tabular format:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%" height="25px"&gt;Fieldname&lt;/TD&gt;
&lt;TD width="50%" height="25px"&gt;Count&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%" height="25px"&gt;aws_account_id&lt;/TD&gt;
&lt;TD width="50%" height="25px"&gt;156&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 14:16:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-total-count-of-unique-values-of-a-field/m-p/613347#M213161</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2022-09-16T14:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Display total count of unique values of a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-total-count-of-unique-values-of-a-field/m-p/613352#M213165</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229059"&gt;@neerajs_81&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;to know how many different aws_account_id you have (result is a number) , you have to use the dc option in stats command:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=aws sourcetype="aws:cloudtrail" 
| stats dc(aws_account_id) AS aws_account_id_count&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 06:31:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-total-count-of-unique-values-of-a-field/m-p/613352#M213165</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-09-16T06:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Display total count of unique values of a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-total-count-of-unique-values-of-a-field/m-p/613360#M213166</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;that 100+ is not an exact number. It just show that this field have more than 100 different values (as you have count it is 156 in your case). One way to get your wanted output is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=aws sourcetype="aws:cloudtrail" 
| fields aws_account_id 
| stats dc(count) as Count 
| eval Fieldname = "aws_account_id"
| table Fieldname Count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 07:19:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-total-count-of-unique-values-of-a-field/m-p/613360#M213166</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-09-16T07:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Display total count of unique values of a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-total-count-of-unique-values-of-a-field/m-p/613364#M213167</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229059"&gt;@neerajs_81&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 08:04:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-total-count-of-unique-values-of-a-field/m-p/613364#M213167</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-09-16T08:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Display total count of unique values of a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-total-count-of-unique-values-of-a-field/m-p/613366#M213168</link>
      <description>&lt;P&gt;Thanks, karma points awarded.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 08:27:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-total-count-of-unique-values-of-a-field/m-p/613366#M213168</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2022-09-16T08:27:56Z</dc:date>
    </item>
  </channel>
</rss>

