<?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: Replacing Null values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87603#M22406</link>
    <description>&lt;P&gt;Thanks for your reply but when I try to use, it still doesn't show any results... Don't I expect to see "0" incase there are no results in "Total" after using this fillnull function?&lt;/P&gt;</description>
    <pubDate>Tue, 15 Jan 2013 18:09:48 GMT</pubDate>
    <dc:creator>samsplunkd</dc:creator>
    <dc:date>2013-01-15T18:09:48Z</dc:date>
    <item>
      <title>Replacing Null values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87598#M22401</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;My search looks like below:&lt;BR /&gt;
index=foo search_name="bar" |stats sum(Count) AS Total&lt;/P&gt;

&lt;P&gt;Sometimes Total doesn't have any value and is NULL. Is there a way this NULL can be replaced with 0?&lt;/P&gt;

&lt;P&gt;I tried below two but none worked.&lt;BR /&gt;
a) case(isnull(Total),0)&lt;BR /&gt;
b) coalesce(Total,0)&lt;/P&gt;

&lt;P&gt;Any help is greatly appreciated.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 10:10:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87598#M22401</guid>
      <dc:creator>samsplunkd</dc:creator>
      <dc:date>2013-01-15T10:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Null values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87599#M22402</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;You can try with usenull=f&lt;/P&gt;

&lt;P&gt;In your example: &lt;CODE&gt;index=foo search_name="bar" |stats sum(Count) AS Total usenull=f&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 10:33:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87599#M22402</guid>
      <dc:creator>gfuente</dc:creator>
      <dc:date>2013-01-15T10:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Null values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87600#M22403</link>
      <description>&lt;P&gt;usenull isn't valid for stats, just for chart.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 10:52:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87600#M22403</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-01-15T10:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Null values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87601#M22404</link>
      <description>&lt;P&gt;This is exactly what the &lt;CODE&gt;fillnull&lt;/CODE&gt; command is for.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | fillnull Total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Jan 2013 10:53:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87601#M22404</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-01-15T10:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Null values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87602#M22405</link>
      <description>&lt;P&gt;Ok, thanks for the correction&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 11:06:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87602#M22405</guid>
      <dc:creator>gfuente</dc:creator>
      <dc:date>2013-01-15T11:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Null values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87603#M22406</link>
      <description>&lt;P&gt;Thanks for your reply but when I try to use, it still doesn't show any results... Don't I expect to see "0" incase there are no results in "Total" after using this fillnull function?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 18:09:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87603#M22406</guid>
      <dc:creator>samsplunkd</dc:creator>
      <dc:date>2013-01-15T18:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Null values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87604#M22407</link>
      <description>&lt;P&gt;Reading through the documentation:&lt;BR /&gt;
"Null values are those missing in a particular result, but present for some other result."&lt;/P&gt;

&lt;P&gt;In my case there is only one value instead of multiple events with some having values and others NULL. How do we replace NULL with 0 in case of only one value?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 19:08:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87604#M22407</guid>
      <dc:creator>samsplunkd</dc:creator>
      <dc:date>2013-01-15T19:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Null values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87605#M22408</link>
      <description>&lt;P&gt;When I try your search, on an index with no &lt;CODE&gt;Count&lt;/CODE&gt; fields, I don't get one result with a null. Instead I get no results. Whereas, you instead want to get one result with a zero.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Even if none of the results has the Count field.&lt;/LI&gt;
&lt;LI&gt;Even if there are no results for the search.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I think this will do what you want:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;search_name=not_found | append [ search * | head 1 | eval Count=0 ] | stats sum(Count) AS Total&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This will always give you a total count unless there are no rows that match your selected time frame. It's a bit awkward, though.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 19:29:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87605#M22408</guid>
      <dc:creator>MartinHarper</dc:creator>
      <dc:date>2013-01-15T19:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Null values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87606#M22409</link>
      <description>&lt;P&gt;Yeah the problem is it shows no results when there are no matching events. I want to show "0" in Total in that case.&lt;BR /&gt;
Above doesn't work as field Count won't even exist if there are no matched events.&lt;/P&gt;

&lt;P&gt;Basically I want to say if Total contains nothing, just display 0.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 19:35:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87606#M22409</guid>
      <dc:creator>samsplunkd</dc:creator>
      <dc:date>2013-01-15T19:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Null values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87607#M22410</link>
      <description>&lt;P&gt;Edited, try now.&lt;BR /&gt;
How are you consuming this search? Wondering if a better approach would be to change how it is consumed.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 19:47:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87607#M22410</guid>
      <dc:creator>MartinHarper</dc:creator>
      <dc:date>2013-01-15T19:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Null values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87608#M22411</link>
      <description>&lt;P&gt;Correct syntax for more clarity:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | fillnull value=NULL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Reference:&lt;/STRONG&gt; &lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/fillnull"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/fillnull&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Aug 2018 00:29:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-Null-values/m-p/87608#M22411</guid>
      <dc:creator>jawaharas</dc:creator>
      <dc:date>2018-08-02T00:29:44Z</dc:date>
    </item>
  </channel>
</rss>

