<?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: Show a result even if no events match in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Show-a-result-even-if-no-events-match/m-p/22530#M3889</link>
    <description>&lt;P&gt;What about a &lt;CODE&gt;| fillnull value=0&lt;/CODE&gt;? Would that fit the bill?&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2016 19:38:42 GMT</pubDate>
    <dc:creator>Thomas_Aneiro</dc:creator>
    <dc:date>2016-09-16T19:38:42Z</dc:date>
    <item>
      <title>Show a result even if no events match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-result-even-if-no-events-match/m-p/22526#M3885</link>
      <description>&lt;P&gt;As part of a larger project, one of the things we want to do is to let the user build tables with one search criteria at a time. So for example, the table might ultimately be defined with a search like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="log.log" foo="foo" OR foo="bar" OR foo="eggs" OR foo="spam" | chart count by foo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That part is already finished. The problem we run into is if, for this example, there are no records where foo="eggs". Splunk will, by default, not show any results for "eggs". Is there a way to get it to show "eggs" anyways with a count of 0 by using the basic modules, or will we have to build our own to add that behavior?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2013 17:00:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-result-even-if-no-events-match/m-p/22526#M3885</guid>
      <dc:creator>DaleFRice</dc:creator>
      <dc:date>2013-08-01T17:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Show a result even if no events match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-result-even-if-no-events-match/m-p/22527#M3886</link>
      <description>&lt;P&gt;This is the sort of question that feels like it has a UI answer, but the answers are all going to be search language answers. &lt;/P&gt;

&lt;P&gt;here's one wacky way: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;source="log.log" foo="foo" OR foo="bar" OR foo="eggs" OR foo="spam" | eval count="1" | append [| stats count | fields - count | eval foo=split("foo,bar,eggs,spam",",") | eval count="0" | mvexpand foo] | chart sum(count) as count by foo&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;In english,  you basically append another really tiny static data set where the counts for the four values are all going to be zero. &lt;/P&gt;

&lt;P&gt;Here's another way that I thought might be simpler, but it ended up even weirder looking. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;source="log.log" foo="foo" OR foo="bar" OR foo="eggs" OR foo="spam" | eval count="1" | append [| stats count | fields - count | eval foo="no value" | eval count="0" ] | stats sum(count) as count by foo | eval magic="1" | xyseries magic foo count | fillnull foo bar eggs spam value="0" | untable magic foo count | fields - magic&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;We basically use xyseries to get a set that is "fillnull-able", then untable to switch it back into its original form. &lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2013 18:52:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-result-even-if-no-events-match/m-p/22527#M3886</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2013-08-01T18:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Show a result even if no events match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-result-even-if-no-events-match/m-p/22528#M3887</link>
      <description>&lt;P&gt;Here's another wacky way, presuming you know all of the possible values of &lt;CODE&gt;foo&lt;/CODE&gt; in advance.  Make a lookup table as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;foo,count
foo,0
bar,0
eggs,0
spam,0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And use it like so&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=log.log foo="foo" OR foo="bar" OR foo="eggs" OR foo="spam" 
| stats count by foo 
| inputlookup append=t foolookup.csv
| stats max(count) as count by foo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The values in the lookup make a 'sentinel' of sorts, making sure your results always exist.  And the max picks out either your real count or the sentinel.  Unless your real count is negative .. but that would be weird.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2013 19:10:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-result-even-if-no-events-match/m-p/22528#M3887</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2013-08-01T19:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Show a result even if no events match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-result-even-if-no-events-match/m-p/22529#M3888</link>
      <description>&lt;P&gt;thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2013 20:57:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-result-even-if-no-events-match/m-p/22529#M3888</guid>
      <dc:creator>0waste_splunk</dc:creator>
      <dc:date>2013-08-01T20:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: Show a result even if no events match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-result-even-if-no-events-match/m-p/22530#M3889</link>
      <description>&lt;P&gt;What about a &lt;CODE&gt;| fillnull value=0&lt;/CODE&gt;? Would that fit the bill?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2016 19:38:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-result-even-if-no-events-match/m-p/22530#M3889</guid>
      <dc:creator>Thomas_Aneiro</dc:creator>
      <dc:date>2016-09-16T19:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Show a result even if no events match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-result-even-if-no-events-match/m-p/22531#M3890</link>
      <description>&lt;P&gt;For the purpose of visualizing the problem, think of splunk results and fields in terms of "rows" and "columns".  When you do a search, and do something like &lt;CODE&gt;| stats max(foo) by bar&lt;/CODE&gt; then you get a new "row" for each value of bar, and a "column" for max(foo).  If a particular value of bar does not have any related value of foo, then &lt;CODE&gt;fillnull&lt;/CODE&gt; is perfectly appropriate.  But, you can't fillnull what does not exist.&lt;/P&gt;

&lt;P&gt;Drawing an example, suppose you have a brick-and-mortar store and wanted to compute &lt;CODE&gt;| stats sum(sales) by day_of_month&lt;/CODE&gt; for December.  On December 25th the store was &lt;EM&gt;closed&lt;/EM&gt;.  The results of our stats cannot possibly have a row for "25".   We cannot &lt;CODE&gt;fillnull&lt;/CODE&gt; to make a result row that does not exist.   Does this make sense?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 05:03:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-result-even-if-no-events-match/m-p/22531#M3890</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2016-09-19T05:03:50Z</dc:date>
    </item>
  </channel>
</rss>

