<?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: fill in 0 when there is no data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442794#M168981</link>
    <description>&lt;P&gt;Yes, you can use &lt;CODE&gt;| makeresults&lt;/CODE&gt; in your search to create that missing data then create some conditional logic to fill null values OR leave it as-is. Here's an example &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval domain_name=""
| [search index=.... &amp;lt;YOUR SEARCH&amp;gt;]
| eval domain_name=if(isnull(domain_name),"0",'domain_name')
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Jun 2018 14:29:29 GMT</pubDate>
    <dc:creator>skoelpin</dc:creator>
    <dc:date>2018-06-11T14:29:29Z</dc:date>
    <item>
      <title>fill in 0 when there is no data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442788#M168975</link>
      <description>&lt;P&gt;i have an index that calc amount of events for a specific domain name&lt;BR /&gt;
this index have 3 fields: date,domain_name, event_count&lt;BR /&gt;
if a domain have no event_count for a specific date than i don't have that record in the index&lt;BR /&gt;
can i manipulate splunk into thinking that on missing dates for the last month the value was 0 (besides adding this data to the file)?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:52:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442788#M168975</guid>
      <dc:creator>mcohen13</dc:creator>
      <dc:date>2020-09-29T19:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: fill in 0 when there is no data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442789#M168976</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I think this is what you are looking for:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.1.0/SearchReference/Fillnull"&gt;https://docs.splunk.com/Documentation/Splunk/7.1.0/SearchReference/Fillnull&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 08:47:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442789#M168976</guid>
      <dc:creator>poete</dc:creator>
      <dc:date>2018-06-11T08:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: fill in 0 when there is no data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442790#M168977</link>
      <description>&lt;P&gt;fillnull will not to the job&lt;BR /&gt;
because i don't have &lt;STRONG&gt;null&lt;/STRONG&gt; values in that field for a specific date&lt;BR /&gt;
i have &lt;STRONG&gt;no&lt;/STRONG&gt; values for that date&lt;/P&gt;

&lt;P&gt;for example :&lt;BR /&gt;
Query:&lt;BR /&gt;
index="someindex" "domain"="&lt;EM&gt;domain_x&lt;/EM&gt;" ] | chart max(event_count) over date&lt;BR /&gt;
data:&lt;BR /&gt;
date    domain_x&lt;BR /&gt;
2018-06-02  128&lt;BR /&gt;
2018-06-03  623&lt;BR /&gt;
2018-06-04  331&lt;/P&gt;

&lt;P&gt;now i want to add that on other dates of the last month the value was 0 so i can call &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:52:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442790#M168977</guid>
      <dc:creator>mcohen13</dc:creator>
      <dc:date>2020-09-29T19:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: fill in 0 when there is no data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442791#M168978</link>
      <description>&lt;P&gt;@mcohen13, As far as your &lt;CODE&gt;date&lt;/CODE&gt; field is having epoch time and not string time, fillnull should work. If it is string time then you either need to convert it to epoch using &lt;CODE&gt;strptime()&lt;/CODE&gt; or use &lt;CODE&gt;_time&lt;/CODE&gt; with &lt;CODE&gt;span=1d&lt;/CODE&gt; instead.&lt;/P&gt;

&lt;P&gt;Following is a run anywhere search based on Splunk's _internal index similar to your question (instead of &lt;CODE&gt;1d&lt;/CODE&gt; I have used &lt;CODE&gt;1h&lt;/CODE&gt;, to form more buckets).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="_internal" "sourcetype"="splunkd" log_level=INFO
| chart span=1h max(cpu_seconds) as MaxValue over _time
| fillnull value=0 MaxValue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have give &lt;CODE&gt;max(cpu_seconds)&lt;/CODE&gt; an alias  &lt;CODE&gt;MaxValue&lt;/CODE&gt; and used fillnull for &lt;CODE&gt;MaxValue&lt;/CODE&gt;.  You can try without final fillnull command to see if Null Values are actually present or not.&lt;/P&gt;

&lt;P&gt;Also, if you are plotting the result in chart, in the Chart Configuration Options i.e. Edit UI Panel and Format Visualization to change the &lt;CODE&gt;Null Value&lt;/CODE&gt; to &lt;CODE&gt;Zero&lt;/CODE&gt; to have similar efffect directly in chart (without using fillnull command).&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 11:19:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442791#M168978</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-06-11T11:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: fill in 0 when there is no data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442792#M168979</link>
      <description>&lt;P&gt;I thought fillnull is only good for charting?  He never said he was charting, I think he needs to put in a whole record for that entry he is missing...&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:49:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442792#M168979</guid>
      <dc:creator>jlvix1</dc:creator>
      <dc:date>2018-06-11T13:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: fill in 0 when there is no data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442793#M168980</link>
      <description>&lt;P&gt;Where are the events coming from that are in this index?  Sounds to me like the data source itself is at fault and you're missing events, leaving you with gaping holes in your data because you should be getting zero-based events.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:51:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442793#M168980</guid>
      <dc:creator>jlvix1</dc:creator>
      <dc:date>2018-06-11T13:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: fill in 0 when there is no data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442794#M168981</link>
      <description>&lt;P&gt;Yes, you can use &lt;CODE&gt;| makeresults&lt;/CODE&gt; in your search to create that missing data then create some conditional logic to fill null values OR leave it as-is. Here's an example &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval domain_name=""
| [search index=.... &amp;lt;YOUR SEARCH&amp;gt;]
| eval domain_name=if(isnull(domain_name),"0",'domain_name')
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jun 2018 14:29:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442794#M168981</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-06-11T14:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: fill in 0 when there is no data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442795#M168982</link>
      <description>&lt;P&gt;i get this error:&lt;BR /&gt;
"Error in 'SearchParser': Subsearches are only valid as arguments to commands. Error at position '31' of search query '| makeresults | eval info="" | [search index="doma'."&lt;BR /&gt;
The query:&lt;BR /&gt;
| makeresults | eval info="" | [search index="domain_event_agg_info" event_domain="XXXX.YYY."] | eval info=if(isnull(event_count),"0",'event_count')&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:53:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/fill-in-0-when-there-is-no-data/m-p/442795#M168982</guid>
      <dc:creator>mcohen13</dc:creator>
      <dc:date>2020-09-29T19:53:08Z</dc:date>
    </item>
  </channel>
</rss>

