<?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 remove rows with Zero value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363060#M107247</link>
    <description>&lt;P&gt;@493669, thanks! I used where Total!=0 instead&lt;/P&gt;</description>
    <pubDate>Fri, 09 Feb 2018 05:29:21 GMT</pubDate>
    <dc:creator>auaave</dc:creator>
    <dc:date>2018-02-09T05:29:21Z</dc:date>
    <item>
      <title>How to remove rows with Zero value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363058#M107245</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;

&lt;P&gt;I am making a dashboard with Error Duration per RobotId. Since the duration is in seconds, I rounded it to the nearest Minute. In doing this, if the error duration is less than 1 min the error duration is "0".&lt;/P&gt;

&lt;P&gt;How can I get rid of the row where the description is equals to "0" duration? &lt;/P&gt;

&lt;P&gt;Thanks a lot!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval DURATION=round(DURATION/60) 
| chart sum(DURATION) as "DURATION" over DESCRIPTION by ROBOTID
| addtotals | sort Total Desc
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Feb 2018 05:17:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363058#M107245</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-02-09T05:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove rows with Zero value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363059#M107246</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...|where DURATION!=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Feb 2018 05:24:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363059#M107246</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-09T05:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove rows with Zero value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363060#M107247</link>
      <description>&lt;P&gt;@493669, thanks! I used where Total!=0 instead&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 05:29:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363060#M107247</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-02-09T05:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove rows with Zero value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363061#M107248</link>
      <description>&lt;P&gt;Just some additional information. The title of your post was about null values. Zero is a value.  Null is no value at all.  if you ever want to test strictly on null or not null without regards to value. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | where isnull(DURATION)

... | where isnotnull(DURATION)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Feb 2018 18:31:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363061#M107248</guid>
      <dc:creator>starcher</dc:creator>
      <dc:date>2018-02-10T18:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove rows with Zero value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363062#M107249</link>
      <description>&lt;P&gt;Couple of cycles less ; -) with &lt;CODE&gt;DURATION!=0 | eval DURATION=round(DURATION/60) |where DURATION!=0&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Feb 2018 00:56:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363062#M107249</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2018-02-11T00:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove rows with Zero value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363063#M107250</link>
      <description>&lt;P&gt;Everyone, ** &lt;CODE&gt;DURATION&lt;/CODE&gt; ** field will not be available in the sample search provided in the question since the &lt;CODE&gt;chart&lt;/CODE&gt; command has &lt;CODE&gt;over&lt;/CODE&gt; and &lt;CODE&gt;by&lt;/CODE&gt; attributes which means the &lt;CODE&gt;values for ROBOTIDs&lt;/CODE&gt; will be available as fields and &lt;CODE&gt;not DURATION&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;@auaave, You should try the following based on couple of search optimization techniques:&lt;/P&gt;

&lt;P&gt;1) Use DURATION, DESCRIPTION and ROBOTID in your base search filter to ensure only events with the three fields present are filtered.&lt;BR /&gt;
2) Use stats first before eval. This will have two advantages:&lt;BR /&gt;
    (i) Performance improvement as eval should be applied on aggregated data rather than all events.&lt;BR /&gt;
    (ii) DURATION field will be available for filtering. So search filter can be applied upfront to remove the unwanted data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt; DURATION=* DESCRIPTION=* ROBOTID=*
 | stats sum(DURATION) as DURATION by DESCRIPTION ROBOTID
 | eval DURATION=round(DURATION/60) 
 | search DURATION!=0
 | chart sum(DURATION) as "DURATION" over DESCRIPTION by ROBOTID
 | addtotals row=t col=f fieldname=Total
 | fillnull value=0
 | sort - Total Desc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Other changes like &lt;CODE&gt;fillnull&lt;/CODE&gt; and &lt;CODE&gt;sort - Total&lt;/CODE&gt; I have suggested based on ideal use case but they are not mandatory to be implemented based on what you are trying to display to the users. For example without &lt;CODE&gt;fillnull value=0&lt;/CODE&gt; if you are using&lt;CODE&gt;table&lt;/CODE&gt;, it will show null values. However, if you are using chart, there is a &lt;CODE&gt;Format Visualization&lt;/CODE&gt; option to fill &lt;CODE&gt;Null&lt;/CODE&gt; values while displaying the chart (line or area).&lt;BR /&gt;&lt;BR /&gt;
Following is a run anywhere search similar to the one in the question based on Splunk's _internal index&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd log_level=* component=*  date_second=*
| stats sum(date_second) as DURATION by component log_level
| eval DURATION=round(DURATION/60)
| search DURATION!=0
| chart sum(DURATION) as DURATION over component by log_level
| addtotals row=t col=f fieldname=Total
| fillnull value=0
| sort - Total component
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out and confirm. You can confirm the performance of this approach vs your current query in the Splunk Search Job Inspector. Do read the documentation on some of the query optimization techniques: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Search/Quicktipsforoptimization"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Search/Quicktipsforoptimization&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Feb 2018 05:24:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363063#M107250</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-02-11T05:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove rows with Zero value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363064#M107251</link>
      <description>&lt;P&gt;@ starcher, yes you are right! I have updated the title. Thanks a lot for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 22:30:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363064#M107251</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-02-12T22:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove rows with Zero value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363065#M107252</link>
      <description>&lt;P&gt;@ddrillic, thanks a lot for your help! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 22:31:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363065#M107252</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-02-12T22:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove rows with Zero value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363066#M107253</link>
      <description>&lt;P&gt;@niketnilay, thanks a lot for your help and advise. Learned a lot from and you and the query works well. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 22:32:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363066#M107253</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-02-12T22:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove rows with Zero value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363067#M107254</link>
      <description>&lt;P&gt;Anytime @auaave, Splunk Answers is a wonderful community, it teaches us something everyday. Keep learning and keep helping others &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 15:02:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/363067#M107254</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-02-13T15:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove rows with Zero value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/553128#M157013</link>
      <description>&lt;P&gt;Thanks for this idea, this helped me to resolve this issue soon.&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 11:45:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-rows-with-Zero-value/m-p/553128#M157013</guid>
      <dc:creator>SG</dc:creator>
      <dc:date>2021-05-26T11:45:35Z</dc:date>
    </item>
  </channel>
</rss>

