<?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: combining distinct count and count in one table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/combining-distinct-count-and-count-in-one-table/m-p/111355#M29174</link>
    <description>&lt;P&gt;yw. Also, always use "|metasearch" if you're dealing with just any of these fields - host,source, sourcetype, index, splunk_server.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Mar 2014 15:06:04 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2014-03-28T15:06:04Z</dc:date>
    <item>
      <title>combining distinct count and count in one table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combining-distinct-count-and-count-in-one-table/m-p/111352#M29171</link>
      <description>&lt;P&gt;I have two indexers that are being load balanced.  I am interested to see the distribution of events from each host onto the indexers.&lt;/P&gt;

&lt;P&gt;To get a list of hosts and the number of events on each indexer, I can run:&lt;BR /&gt;&lt;BR /&gt;
host=* | stats count by host splunk_server | sort host&lt;/P&gt;

&lt;P&gt;I am also interested in hosts that are only writing to a single indexer.  To get this I can run:&lt;BR /&gt;&lt;BR /&gt;
host=* | stats dc(splunk_server) as Splunk_Server by host | where Splunk_Server==1&lt;/P&gt;

&lt;P&gt;How can I combine the two to show me the number of events from a host when it is only on a single indexer?  &lt;/P&gt;

&lt;P&gt;I am still running splunk 5 if that is relevant.  &lt;/P&gt;

&lt;P&gt;Thanks.  &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:15:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combining-distinct-count-and-count-in-one-table/m-p/111352#M29171</guid>
      <dc:creator>JWBailey</dc:creator>
      <dc:date>2020-09-28T16:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: combining distinct count and count in one table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combining-distinct-count-and-count-in-one-table/m-p/111353#M29172</link>
      <description>&lt;P&gt;Try following (faster as well)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metasearch host=* | stats first(splunk_server) as Indexer dc(splunk_server) as CountIndexers, count by host | where CountIndexers=1 | fields - CountIndexers
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Mar 2014 14:23:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combining-distinct-count-and-count-in-one-table/m-p/111353#M29172</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-03-28T14:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: combining distinct count and count in one table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combining-distinct-count-and-count-in-one-table/m-p/111354#M29173</link>
      <description>&lt;P&gt;OK... i see.. you can perform multiple different operations within the same stats command.  &lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 14:53:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combining-distinct-count-and-count-in-one-table/m-p/111354#M29173</guid>
      <dc:creator>JWBailey</dc:creator>
      <dc:date>2014-03-28T14:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: combining distinct count and count in one table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combining-distinct-count-and-count-in-one-table/m-p/111355#M29174</link>
      <description>&lt;P&gt;yw. Also, always use "|metasearch" if you're dealing with just any of these fields - host,source, sourcetype, index, splunk_server.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 15:06:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combining-distinct-count-and-count-in-one-table/m-p/111355#M29174</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-03-28T15:06:04Z</dc:date>
    </item>
  </channel>
</rss>

