<?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: count (all) / Count (unique) = result -&amp;gt; chart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308973#M175449</link>
    <description>&lt;P&gt;eventstats is totally unnecessary in this one. Delete that line and on the next line,  change last(FullCount) to count.&lt;/P&gt;</description>
    <pubDate>Mon, 20 Feb 2017 20:38:35 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-02-20T20:38:35Z</dc:date>
    <item>
      <title>count (all) / Count (unique) = result -&gt; chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308966#M175442</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;

&lt;P&gt;I have a logfile looking like this:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Host ----- Message&lt;/STRONG&gt;&lt;BR /&gt;
test ----- Error1&lt;BR /&gt;
test ----- Error1&lt;BR /&gt;
prod ----- Error2&lt;BR /&gt;
prod ----- Error2&lt;BR /&gt;
test ----- Error2&lt;BR /&gt;
test ----- Error2&lt;BR /&gt;
prod ----- Error3&lt;BR /&gt;
prod ----- Error3&lt;/P&gt;

&lt;P&gt;Now i want &lt;STRONG&gt;one&lt;/STRONG&gt; chart with &lt;STRONG&gt;three&lt;/STRONG&gt; numbers. At first only a unique count of the hosts (2 test, prod), second the full count of the messages (8) and at last the result of the unique count divide the full count (8 / 2 = 4). &lt;/P&gt;

&lt;P&gt;I tried it with transcaption and where eventcode=1 to make a count without duplicates. That works very well. &lt;BR /&gt;
And I found a way to make calculations. But I don't know how to combine both. &lt;/P&gt;

&lt;P&gt;Hope you can help me, thanks for all.&lt;/P&gt;

&lt;P&gt;dexxter275&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 06:31:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308966#M175442</guid>
      <dc:creator>dexxter275</dc:creator>
      <dc:date>2017-02-20T06:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: count (all) / Count (unique) = result -&gt; chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308967#M175443</link>
      <description>&lt;P&gt;Try the following. Use eventstats to compute Total stats and add the the events.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Your Base Search&amp;gt;
| eventstats count(Message) as FullCount
| stats dc(Host ) as UniqueCount last(FullCount) as FullCount
| eval ratio=round(FullCount/UniqueCount,2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Feb 2017 08:37:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308967#M175443</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-02-20T08:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: count (all) / Count (unique) = result -&gt; chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308968#M175444</link>
      <description>&lt;P&gt;Wow. That works perfectly. Thanks so much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 08:49:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308968#M175444</guid>
      <dc:creator>dexxter275</dc:creator>
      <dc:date>2017-02-20T08:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: count (all) / Count (unique) = result -&gt; chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308969#M175445</link>
      <description>&lt;P&gt;@dexxter275... kindly accept if this solved your problem. Let me know otherwise.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 09:06:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308969#M175445</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-02-20T09:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: count (all) / Count (unique) = result -&gt; chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308970#M175446</link>
      <description>&lt;P&gt;It's me again. Your answer helps me a lot and did exactly what i want. Thank you for that. &lt;/P&gt;

&lt;P&gt;I thought about a history about the last 7 days (for every day one line). And found this question: &lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/239649/need-to-get-stats-count-by-day.html+"&gt;https://answers.splunk.com/answers/239649/need-to-get-stats-count-by-day.html &lt;/A&gt;&lt;BR /&gt;
They used "bucket _time span=day" to separate the day. &lt;/P&gt;

&lt;P&gt;Do you know how I implement this? I tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;SEARCH&amp;gt; | bucket date span=day | eventstats count(errormessage) as FullCount | stats dc(machine) as UniqueCount last(FullCount) as FullCount | eval ratio=round(FullCount/UniqueCount,2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but it doesn't work. The field "16/02/2017" is calling date. I do my best and start searching again but maybe you can help me again. &lt;/P&gt;

&lt;P&gt;Thanks so much. &lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 12:38:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308970#M175446</guid>
      <dc:creator>dexxter275</dc:creator>
      <dc:date>2017-02-20T12:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: count (all) / Count (unique) = result -&gt; chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308971#M175447</link>
      <description>&lt;P&gt;The pattern of &lt;CODE&gt;eventstats | stats&lt;/CODE&gt; is terrible. &lt;CODE&gt;eventstats&lt;/CODE&gt; lifts all data from the indexers to the search head, goes through all data once, passes all data to &lt;CODE&gt;stats&lt;/CODE&gt;, then &lt;CODE&gt;stats&lt;/CODE&gt; goes through all data again. Instead, use this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search | bucket span=1d _time 
| stats count as FullCount dc(machine) as UniqueCount by _time
| eval ratio = round(FullCount/UniqueCount, 2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now &lt;CODE&gt;stats&lt;/CODE&gt; only needs to go over all data once, and the indexers can do the bulk of the work before only returning a tiny resultset to the search head.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 12:51:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308971#M175447</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-02-20T12:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: count (all) / Count (unique) = result -&gt; chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308972#M175448</link>
      <description>&lt;P&gt;Damn you are good. Thats great and exactly doing what I have in my mind. &lt;BR /&gt;
Thanks!!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 12:57:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308972#M175448</guid>
      <dc:creator>dexxter275</dc:creator>
      <dc:date>2017-02-20T12:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: count (all) / Count (unique) = result -&gt; chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308973#M175449</link>
      <description>&lt;P&gt;eventstats is totally unnecessary in this one. Delete that line and on the next line,  change last(FullCount) to count.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 20:38:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308973#M175449</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-02-20T20:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: count (all) / Count (unique) = result -&gt; chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308974#M175450</link>
      <description>&lt;P&gt;@dexxter275... That is why I follow @martin_mueller &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 15:21:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-all-Count-unique-result-gt-chart/m-p/308974#M175450</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-02-21T15:21:02Z</dc:date>
    </item>
  </channel>
</rss>

