<?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: When using &amp;quot;tstats count&amp;quot;, how to display zero results if there are no counts to display? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326715#M97350</link>
    <description>&lt;P&gt;That worked. Thanks a lot!&lt;/P&gt;</description>
    <pubDate>Fri, 03 Mar 2017 14:08:49 GMT</pubDate>
    <dc:creator>jsh315</dc:creator>
    <dc:date>2017-03-03T14:08:49Z</dc:date>
    <item>
      <title>When using "tstats count", how to display zero results if there are no counts to display?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326707#M97342</link>
      <description>&lt;P&gt;I need to use tstats vs stats for performance reasons.  I would like tstats count to show 0 if there are no counts to display.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count where index="abc" by _time span=1h
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This would return a table with _time (every hour) and count, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time                   count
2017-01-01 12:00        50
2017-01-01 13:00        62
2017-01-01 14:00        14
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But if the count is zero, it doesn't return that row.  How do I get this to display 0 count for that hour?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 19:14:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326707#M97342</guid>
      <dc:creator>jsh315</dc:creator>
      <dc:date>2017-02-27T19:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: When using "tstats count", how to display zero results if there are no counts to display?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326708#M97343</link>
      <description>&lt;P&gt;How about this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | tstats count where index="abc" by _time span=1h | makecontinuous span=1h _time | fillnull value=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Feb 2017 19:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326708#M97343</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-02-27T19:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: When using "tstats count", how to display zero results if there are no counts to display?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326709#M97344</link>
      <description>&lt;P&gt;Did not work.  Still getting empty rows for where count is zero.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 20:39:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326709#M97344</guid>
      <dc:creator>jsh315</dc:creator>
      <dc:date>2017-02-27T20:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: When using "tstats count", how to display zero results if there are no counts to display?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326710#M97345</link>
      <description>&lt;P&gt;Try this instead&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | tstats count where index="abc" by _time span=1h | timechart span=1h max(count) as count | fillnull value=0 count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Feb 2017 21:01:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326710#M97345</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-02-27T21:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: When using "tstats count", how to display zero results if there are no counts to display?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326711#M97346</link>
      <description>&lt;P&gt;That worked.  If you have time I would greatly appreciate the explanation of your query.  Thank you so much.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 21:10:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326711#M97346</guid>
      <dc:creator>jsh315</dc:creator>
      <dc:date>2017-02-27T21:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: When using "tstats count", how to display zero results if there are no counts to display?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326712#M97347</link>
      <description>&lt;P&gt;&lt;CODE&gt;timechart&lt;/CODE&gt; by default (unless you specify &lt;CODE&gt;fixedrange=f&lt;/CODE&gt;) creates a row for each time bucket from the beginning of the search period until the end of the search period. So, the &lt;CODE&gt;timechart&lt;/CODE&gt; creates all the necessary rows, and then &lt;CODE&gt;fillnull&lt;/CODE&gt; puts a 0 in all empty row.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 21:59:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326712#M97347</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-02-27T21:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: When using "tstats count", how to display zero results if there are no counts to display?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326713#M97348</link>
      <description>&lt;P&gt;Thanks for the response.  Your solution works if there is at least one row that returned some count but if all the rows had zero count then I get "No results found.".  Is there a solution to handle this case as well?  Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 20:50:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326713#M97348</guid>
      <dc:creator>jsh315</dc:creator>
      <dc:date>2017-02-28T20:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: When using "tstats count", how to display zero results if there are no counts to display?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326714#M97349</link>
      <description>&lt;P&gt;Yes, you can use &lt;CODE&gt;append&lt;/CODE&gt; to include a dummy value that gets filtered out if there is real data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count where index="abc" by _time span=1h 
| addtotals fieldname=Total
| append [|gentimes start=-1 | addinfo | table info_min_time | bin info_min_time as _time span=1h | eval count = 0 | eval Total = 0 | table _time count Total]
| where (Total = 0 OR count &amp;gt; 0)
| timechart span=1h max(count) as count
| fillnull value=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Feb 2017 22:56:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326714#M97349</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-02-28T22:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: When using "tstats count", how to display zero results if there are no counts to display?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326715#M97350</link>
      <description>&lt;P&gt;That worked. Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 14:08:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-using-quot-tstats-count-quot-how-to-display-zero-results-if/m-p/326715#M97350</guid>
      <dc:creator>jsh315</dc:creator>
      <dc:date>2017-03-03T14:08:49Z</dc:date>
    </item>
  </channel>
</rss>

