<?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 insert an entry in the report when the count is zero in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-insert-an-entry-in-the-report-when-the-count-is-zero/m-p/142090#M184917</link>
    <description>&lt;P&gt;Splunk will not return a value for field that does not contains values.&lt;/P&gt;

&lt;P&gt;you can create a lookup with your list of buck, and use a join type-outer to match your results to it, and display the missing values.&lt;/P&gt;

&lt;P&gt;see this example : &lt;A href="http://answers.splunk.com/answers/125101/how-to-show-count-as-0-for-rangemap-if-a-range-does-not-exist"&gt;http://answers.splunk.com/answers/125101/how-to-show-count-as-0-for-rangemap-if-a-range-does-not-exist&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Jul 2014 05:02:40 GMT</pubDate>
    <dc:creator>yannK</dc:creator>
    <dc:date>2014-07-15T05:02:40Z</dc:date>
    <item>
      <title>how to insert an entry in the report when the count is zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-insert-an-entry-in-the-report-when-the-count-is-zero/m-p/142089#M184916</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I need to generate a report like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;appName | buck | count
abc  |  &amp;lt;=1 minute | 5
abc  |  &amp;gt;1 min. &amp;amp;&amp;amp; &amp;lt;=10 min. | 0
abc  |  &amp;gt;10 min. &amp;amp;&amp;amp; &amp;lt;=30 min. | 5
xyz  |  &amp;lt;=1 minute | 0
xyz  |  &amp;gt;1 min. &amp;amp;&amp;amp; &amp;lt;=10 min. | 1
xyz  |  &amp;gt;10 min. &amp;amp;&amp;amp; &amp;lt;=30 min. | 15
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;my query is doing the job for the most part, except when the count is zero, splunk does not show a entry for it, so instead it gives the following (notifice row #2 and #4 is missing )&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;appName | buck | count
abc  |  &amp;lt;=1 minute | 5
(I need it to show a zero count row here)
abc  |  &amp;gt;10 min. &amp;amp;&amp;amp; &amp;lt;=30 min. | 5
(I need it to show a zero count row here)
xyz  |  &amp;gt;1 min. &amp;amp;&amp;amp; &amp;lt;=10 min. | 1
xyz  |  &amp;gt;10 min. &amp;amp;&amp;amp; &amp;lt;=30 min. | 15
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;here's my search&lt;/P&gt;

&lt;P&gt;search | eval buck=case(waitTimeSec &amp;lt;= 60, "&amp;lt;= 1min", waitTimeSec &amp;lt;= 600, "&amp;gt; 1min &amp;amp;&amp;amp; &amp;lt;=10 min ", waitTimeSec &amp;lt;= 1800, "&amp;gt;10min &amp;amp;&amp;amp; &amp;lt;=30 min.") | stats  count(event) as count by appName,  buck&lt;/P&gt;

&lt;P&gt;any pointer is appreciated.  thanks. &lt;/P&gt;

&lt;H6&gt;### new info&lt;/H6&gt;

&lt;P&gt;thanks for info.  I followed the example you provided, it sort of works but now I cannot get it to group by appName first when I'm using rangemap. here's my new query&lt;/P&gt;

&lt;P&gt;search  |rangemap field=waitTimeSec "1-60"=0-60 "61-600"=61-600 "601-6000000"=601-6000000, "6000001-1600000"=6000001-1600000 |top limit=0 range |inputlookup append=true ntfn-lookup.csv |stats max(count) as mycount by range | sort range&lt;/P&gt;

&lt;P&gt;here's the result&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;range   mycount
1-60     4
61-600   7
601-6000000  14
6000001-1600000  0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;here's my lookup.csv&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;range, count
1-60, 0
61-600, 0
601-6000000,0
6000001-1600000,0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need it to group by appName first , so I tried &lt;/P&gt;

&lt;P&gt;|stats max(count) as mycount by appName, range | sort range&lt;/P&gt;

&lt;P&gt;but this returns no results.&lt;/P&gt;

&lt;P&gt;any help is appreciated, thx&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2014 04:12:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-insert-an-entry-in-the-report-when-the-count-is-zero/m-p/142089#M184916</guid>
      <dc:creator>sjou20</dc:creator>
      <dc:date>2014-07-15T04:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to insert an entry in the report when the count is zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-insert-an-entry-in-the-report-when-the-count-is-zero/m-p/142090#M184917</link>
      <description>&lt;P&gt;Splunk will not return a value for field that does not contains values.&lt;/P&gt;

&lt;P&gt;you can create a lookup with your list of buck, and use a join type-outer to match your results to it, and display the missing values.&lt;/P&gt;

&lt;P&gt;see this example : &lt;A href="http://answers.splunk.com/answers/125101/how-to-show-count-as-0-for-rangemap-if-a-range-does-not-exist"&gt;http://answers.splunk.com/answers/125101/how-to-show-count-as-0-for-rangemap-if-a-range-does-not-exist&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2014 05:02:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-insert-an-entry-in-the-report-when-the-count-is-zero/m-p/142090#M184917</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2014-07-15T05:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to insert an entry in the report when the count is zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-insert-an-entry-in-the-report-when-the-count-is-zero/m-p/142091#M184918</link>
      <description>&lt;P&gt;This should give you an idea..&lt;/P&gt;

&lt;P&gt;&lt;A href="http://answers.splunk.com/answers/23839/include-zero-count-in-stats-count"&gt;http://answers.splunk.com/answers/23839/include-zero-count-in-stats-count&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;As yannK said, you need to maintain a lookup&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2014 11:11:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-insert-an-entry-in-the-report-when-the-count-is-zero/m-p/142091#M184918</guid>
      <dc:creator>strive</dc:creator>
      <dc:date>2014-07-15T11:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to insert an entry in the report when the count is zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-insert-an-entry-in-the-report-when-the-count-is-zero/m-p/142092#M184919</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search.. |rangemap field=waitTimeSec "1-60"=0-60 "61-600"=61-600 "601-6000000"=601-6000000, "6000001-1600000"=6000001-1600000 | stats count(eval(range="1-60")) as "1-60" count(eval(range="61-600")) as "61-600" count(eval(range="601-6000000")) as "601-6000000" count(eval(range="6000001-1600000")) as "6000001-1600000" by appName |  untable appName buck count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Jul 2014 18:42:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-insert-an-entry-in-the-report-when-the-count-is-zero/m-p/142092#M184919</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-15T18:42:18Z</dc:date>
    </item>
  </channel>
</rss>

