<?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: How to default stats to zero when no rows returned in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-default-stats-to-zero-when-no-rows-returned/m-p/750375#M242302</link>
    <description>&lt;P&gt;And what is you stats wants a _time group?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=* source=/my.log
| bin span=5m _time | stats count by _time[,source]&lt;/LI-CODE&gt;&lt;P&gt;00:00 5&lt;BR /&gt;00:05 (no records, skipped)&lt;BR /&gt;00:10 10&lt;BR /&gt;00:15 20&lt;/P&gt;&lt;P&gt;The result will be,&lt;/P&gt;&lt;P&gt;00:00 5&lt;BR /&gt;00:10 10&lt;BR /&gt;00:15 20&lt;/P&gt;&lt;P&gt;The only way in this case is to use a timechart &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=* source=/my.log
| timechart span=5m count by source&lt;/LI-CODE&gt;&lt;P&gt;00:00 5&lt;BR /&gt;00:05 0&lt;BR /&gt;00:10 10&lt;BR /&gt;00:15 20&lt;/P&gt;</description>
    <pubDate>Thu, 24 Jul 2025 05:42:00 GMT</pubDate>
    <dc:creator>verbal_666</dc:creator>
    <dc:date>2025-07-24T05:42:00Z</dc:date>
    <item>
      <title>How to default stats to zero when no rows returned?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-default-stats-to-zero-when-no-rows-returned/m-p/598119#M208282</link>
      <description>&lt;P&gt;I have a query similar to the one below.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;index = "idx" source = "mysource"&amp;nbsp; |spath path=myField output=res|stats count by res&lt;BR /&gt;| where res="xyz"&lt;/P&gt;
&lt;P&gt;Is there a way to get the search to return zero if no rows are returned? The reason Im asking for this is because this is the query Im using to populate values into a dashboard panel. If no rows are returned I would prefer the panel show zero instead of no results.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 16:04:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-default-stats-to-zero-when-no-rows-returned/m-p/598119#M208282</guid>
      <dc:creator>schres1</dc:creator>
      <dc:date>2022-05-17T16:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to default stats to zero when no rows returned</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-default-stats-to-zero-when-no-rows-returned/m-p/598123#M208284</link>
      <description>&lt;P&gt;There might be a more graceful way someone will provide, but I generally add something like this to the end, forcing a row with a 0 value, and then doing another quick sum before displaying it.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| append
[makeresults |eval count=0]
|stats sum(count) as count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 15:48:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-default-stats-to-zero-when-no-rows-returned/m-p/598123#M208284</guid>
      <dc:creator>etoombs</dc:creator>
      <dc:date>2022-05-17T15:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to default stats to zero when no rows returned</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-default-stats-to-zero-when-no-rows-returned/m-p/598130#M208286</link>
      <description>&lt;P&gt;Thank you! I will give this a try!&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 15:53:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-default-stats-to-zero-when-no-rows-returned/m-p/598130#M208286</guid>
      <dc:creator>schres1</dc:creator>
      <dc:date>2022-05-17T15:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to default stats to zero when no rows returned</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-default-stats-to-zero-when-no-rows-returned/m-p/598132#M208287</link>
      <description>&lt;P&gt;This is another way to get count=0&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| appendpipe
    [stats count
    | where count=0
    | eval res="xyz"]&lt;/LI-CODE&gt;&lt;P&gt;Having said that, there may be a better way depending on your full search.&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 15:56:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-default-stats-to-zero-when-no-rows-returned/m-p/598132#M208287</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-17T15:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to default stats to zero when no rows returned</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-default-stats-to-zero-when-no-rows-returned/m-p/750375#M242302</link>
      <description>&lt;P&gt;And what is you stats wants a _time group?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=* source=/my.log
| bin span=5m _time | stats count by _time[,source]&lt;/LI-CODE&gt;&lt;P&gt;00:00 5&lt;BR /&gt;00:05 (no records, skipped)&lt;BR /&gt;00:10 10&lt;BR /&gt;00:15 20&lt;/P&gt;&lt;P&gt;The result will be,&lt;/P&gt;&lt;P&gt;00:00 5&lt;BR /&gt;00:10 10&lt;BR /&gt;00:15 20&lt;/P&gt;&lt;P&gt;The only way in this case is to use a timechart &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=* source=/my.log
| timechart span=5m count by source&lt;/LI-CODE&gt;&lt;P&gt;00:00 5&lt;BR /&gt;00:05 0&lt;BR /&gt;00:10 10&lt;BR /&gt;00:15 20&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jul 2025 05:42:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-default-stats-to-zero-when-no-rows-returned/m-p/750375#M242302</guid>
      <dc:creator>verbal_666</dc:creator>
      <dc:date>2025-07-24T05:42:00Z</dc:date>
    </item>
  </channel>
</rss>

