<?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 How to edit my search to show a row for each hour in my results, even if the count is zero or null? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-a-row-for-each-hour-in-my-results/m-p/213970#M62753</link>
    <description>&lt;P&gt;I have a search that looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;LoginAudit message.name="LoginAudit Event" | eval HourAndMin=strftime(_time, "%H") | stats count(eval(ErrorMessage="SUCCESS"))  as LoginSuccess by HourAndMin
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When this search is run, it gives me a row for each hour. What I am attempting to accomplish is make sure that there is a row for every hour regardless of if data exists or not. &lt;/P&gt;

&lt;P&gt;In my data, I have some results returned for the 9 and 10 slot so the data looks like this&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2112i9F67845CE7CDB678/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;What I would like it to looks like is this:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2113i3896A65301015767/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Where 08 and 11 are set to 0 because there are no results (I have left out the remaining hours in the day for brevity)&lt;/P&gt;</description>
    <pubDate>Mon, 07 Nov 2016 21:58:08 GMT</pubDate>
    <dc:creator>SAPrabhakar</dc:creator>
    <dc:date>2016-11-07T21:58:08Z</dc:date>
    <item>
      <title>How to edit my search to show a row for each hour in my results, even if the count is zero or null?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-a-row-for-each-hour-in-my-results/m-p/213970#M62753</link>
      <description>&lt;P&gt;I have a search that looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;LoginAudit message.name="LoginAudit Event" | eval HourAndMin=strftime(_time, "%H") | stats count(eval(ErrorMessage="SUCCESS"))  as LoginSuccess by HourAndMin
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When this search is run, it gives me a row for each hour. What I am attempting to accomplish is make sure that there is a row for every hour regardless of if data exists or not. &lt;/P&gt;

&lt;P&gt;In my data, I have some results returned for the 9 and 10 slot so the data looks like this&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2112i9F67845CE7CDB678/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;What I would like it to looks like is this:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2113i3896A65301015767/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Where 08 and 11 are set to 0 because there are no results (I have left out the remaining hours in the day for brevity)&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 21:58:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-a-row-for-each-hour-in-my-results/m-p/213970#M62753</guid>
      <dc:creator>SAPrabhakar</dc:creator>
      <dc:date>2016-11-07T21:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to show a row for each hour in my results, even if the count is zero or null?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-a-row-for-each-hour-in-my-results/m-p/213971#M62754</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;LoginAudit message.name="LoginAudit Event" | eval HourAndMin=strftime(_time, "%H") | stats count(eval(ErrorMessage="SUCCESS"))  as LoginSuccess by HourAndMin
| append [| gentimes start=-1 | eval HourAndMin=mvrange(0,24,1) | table HourAndMin | mvexpand HourAndMin
| eval HourAndMin=substr("0".HourAndMin,-2) | eval LoginSuccess=0]
| stats max(LoginSuccess) as LoginSuccess by HourAndMin
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Nov 2016 22:49:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-a-row-for-each-hour-in-my-results/m-p/213971#M62754</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-11-07T22:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to show a row for each hour in my results, even if the count is zero or null?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-a-row-for-each-hour-in-my-results/m-p/213972#M62755</link>
      <description>&lt;P&gt;You can try timechart with span=1h for hourly bins which are filled with 0 by default:&lt;/P&gt;

&lt;P&gt;&amp;lt;Your Base Search&amp;gt; &lt;STRONG&gt;| timechart span=1h count(eval(user="admin")) as LoginSuccess&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 05:00:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-a-row-for-each-hour-in-my-results/m-p/213972#M62755</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-11-08T05:00:45Z</dc:date>
    </item>
  </channel>
</rss>

