<?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 0 counts in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/0-counts/m-p/748072#M241945</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;with this query :&lt;/P&gt;&lt;P&gt;index=abc&lt;BR /&gt;| search source = "xyz"&lt;BR /&gt;| stats count by source&lt;/P&gt;&lt;P&gt;I can see the count of sources having count more than 0.&amp;nbsp;&lt;BR /&gt;But I cant manage to get the ones with 0 count.&amp;nbsp;&lt;BR /&gt;Anyone able to help me please ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jun 2025 06:54:15 GMT</pubDate>
    <dc:creator>av3rag3</dc:creator>
    <dc:date>2025-06-17T06:54:15Z</dc:date>
    <item>
      <title>0 counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/0-counts/m-p/748072#M241945</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;with this query :&lt;/P&gt;&lt;P&gt;index=abc&lt;BR /&gt;| search source = "xyz"&lt;BR /&gt;| stats count by source&lt;/P&gt;&lt;P&gt;I can see the count of sources having count more than 0.&amp;nbsp;&lt;BR /&gt;But I cant manage to get the ones with 0 count.&amp;nbsp;&lt;BR /&gt;Anyone able to help me please ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2025 06:54:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/0-counts/m-p/748072#M241945</guid>
      <dc:creator>av3rag3</dc:creator>
      <dc:date>2025-06-17T06:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: 0 counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/0-counts/m-p/748075#M241946</link>
      <description>&lt;P class="lia-align-left"&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/310987"&gt;@av3rag3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P class="lia-align-left"&gt;at first, don't use the search command after the main search because you'll have slower searches: put all the search terms as left as possible, possibly in the main search.&lt;/P&gt;&lt;P class="lia-align-left"&gt;Then, why do you use the source as BY clausein stats command, if you always have only one source?&lt;/P&gt;&lt;P class="lia-align-left"&gt;In general, without the condition source="xyz", it's normal that you haven't the results of source=0 because you don't have them from the search.&lt;/P&gt;&lt;P class="lia-align-left"&gt;If you have a list of the sources to monitor, you could insert them in a lookup and add them to the search with count=0, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc
| stats count by source
| append [ | inputlookup my_source_lookup.csv | eval count=0 | fields source count ]
| stats sum(count) AS total BY source&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2025 07:06:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/0-counts/m-p/748075#M241946</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-06-17T07:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: 0 counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/0-counts/m-p/748081#M241947</link>
      <description>&lt;P&gt;I would suggest a slightly optimal version that does not use the subsearch&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc
| stats count by source
| inputlookup append=t my_source_lookup.csv 
| fillnull count
| stats sum(count) AS total BY source&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2025 07:37:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/0-counts/m-p/748081#M241947</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2025-06-17T07:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: 0 counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/0-counts/m-p/748872#M242060</link>
      <description>&lt;P&gt;To concur with the above answers, you would have to utilize a lookup file that lists out all of the sources you want to monitor.&lt;/P&gt;&lt;P&gt;Natively, Splunk does not have a source = 0 events. (it doesn't know what it doesn't know).&lt;/P&gt;&lt;P&gt;In the environment we work in, we apply a siar approach but its based on host and whether the sources are coming in or not for our customers.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats values(source) as source, values(sourcetype) as sourcetype
WHERE index=[index]

     [ | inputlookup [myHostLookup].csv
       | fields host ]

by host

| stats count, values(sourcetype) as sourcetype, values(source) as source
by host

| eval Reporting=if(isnull(source), "No Matching Sources", "Yes")
| table host, Reporting, source, sourcetype&lt;/LI-CODE&gt;&lt;P&gt;---&lt;BR /&gt;If this reply helps you, Karma would be appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jun 2025 13:45:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/0-counts/m-p/748872#M242060</guid>
      <dc:creator>antoniolamonica</dc:creator>
      <dc:date>2025-06-27T13:45:50Z</dc:date>
    </item>
  </channel>
</rss>

