<?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: Fillnull with previous known or conditional values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61283#M15119</link>
    <description>&lt;P&gt;Well, not fulltime for a year I guess. Fulltime for a longtime, parttime for many many years. I'm shutting up now.&lt;/P&gt;</description>
    <pubDate>Sat, 19 Mar 2011 15:07:45 GMT</pubDate>
    <dc:creator>sideview</dc:creator>
    <dc:date>2011-03-19T15:07:45Z</dc:date>
    <item>
      <title>Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61277#M15113</link>
      <description>&lt;P&gt;I am logging a number of simple on/off switches that Splunk has done a wonderful job automagically parsing. The data is timestamped, has a field name, and the value which can either be a 1 or a 0 to represent state. The data is only logged when it changes state so, if a switch is turned on, there is one line for that, and one line for it when it turns off. &lt;/P&gt;

&lt;P&gt;My problem is, I would like to fill in the null values in a results table with their previous event value as that would represent the state the field is in until it reflects the next change.&lt;/P&gt;

&lt;P&gt;Any suggestions? I interpret fillnull to be a static solution that isn't applicable to filling null with conditional values. If I'm wrong, please enlighten me.&lt;/P&gt;

&lt;P&gt;arri&lt;/P&gt;

&lt;P&gt;edit:
nick suggested I look at eventstats, in trying this I am not seeing appropriate results. I read the following in the &lt;A href="http://www.splunk.com/base/Documentation/4.2/User/UseReportingCommands#Create_reports_that_display_summary_statistics" rel="nofollow"&gt;documentation&lt;/A&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=access_combined | eventstats avg(kbps) as avgkbps by host

When you run this set of commands, Splunk adds a new avgkbps field to each
sourcetype=access_combined event that includes the kbps field. The value of 
avgkbps is the average kbps for that event.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I am finding is that | eventstats last() is showing only THE last event value and using that throughout. Whereas, what I am hoping to find is something to reveal EACH last event value prior to a known value to fill in the gaps between events in the table kind of like the treatment for null values in the reporting editor allowing one to omit, connect or treat as zero; I'd like to "treat as previous". Since my data value is inherently binary, perhaps there is a simple transform I can apply.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2011 03:19:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61277#M15113</guid>
      <dc:creator>keycoldstorage</dc:creator>
      <dc:date>2011-03-17T03:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61278#M15114</link>
      <description>&lt;P&gt;Well there are a couple missing pieces, but I think I can give you some pieces of your puzzle: &lt;/P&gt;

&lt;P&gt;It sounds to me like the rows in your results table are events.   If that is the case  and you want to kind of paint the later events with whatever the 'last known' state was, then I would look at &lt;STRIKE&gt;eventstats&lt;/STRIKE&gt; `streamstats`,  ie&lt;/P&gt;

&lt;P&gt;&lt;STRIKE&gt;&lt;CODE&gt; &amp;lt;your search terms&amp;gt;&lt;YOUR search="" terms=""&gt; | eventstats last(switchField) as lastKnownState&lt;BR /&gt;
&lt;/YOUR&gt;&lt;/CODE&gt;&lt;/STRIKE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search terms&amp;gt; | streamstats last(switchField) as lastKnownState
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;&lt;STRIKE&gt;eventstats&lt;/STRIKE&gt; streamstats&lt;/CODE&gt; will paint statistics through the set of events, and I think it will do what you're looking for. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;If on the other hand the rows in your results table are not individual events but groups of events,  ie if your search ends in some transforming command like &lt;CODE&gt;stats&lt;/CODE&gt; or &lt;CODE&gt;chart&lt;/CODE&gt; etc..&lt;/P&gt;

&lt;P&gt;Then into your stats command or whatever you can just put a &lt;CODE&gt;last(switchField) as lastKnownState&lt;/CODE&gt; and it'll do the same thing.   However if that was the case I suspect you would have discovered the answer already. &lt;/P&gt;

&lt;P&gt;UPDATE: streamstats is what you are looking for, not eventstats. Hence the changes and strikethroughs you see above. &lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2011 03:58:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61278#M15114</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-03-17T03:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61279#M15115</link>
      <description>&lt;P&gt;Thank you Nick, I'll take a look at eventstats. You are correct in surmising that each row represents an individual event, or in my case an individual binary state change.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2011 21:23:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61279#M15115</guid>
      <dc:creator>keycoldstorage</dc:creator>
      <dc:date>2011-03-18T21:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61280#M15116</link>
      <description>&lt;P&gt;Actually I may have misspoke, it may be the streamstats command that you're looking for.  I dont use these very often I'm afraid but when you need them they're very cool.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2011 23:38:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61280#M15116</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-03-18T23:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61281#M15117</link>
      <description>&lt;P&gt;A thousands hurrays for streamstats!&lt;/P&gt;</description>
      <pubDate>Sat, 19 Mar 2011 14:42:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61281#M15117</guid>
      <dc:creator>hexx</dc:creator>
      <dc:date>2011-03-19T14:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61282#M15118</link>
      <description>&lt;P&gt;Yea. The search language rocks. It is pretty hard to find the bottom on this thing.  I've been building splunk apps fulltime for over a year and I'm still learning a ton.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Mar 2011 14:56:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61282#M15118</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-03-19T14:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61283#M15119</link>
      <description>&lt;P&gt;Well, not fulltime for a year I guess. Fulltime for a longtime, parttime for many many years. I'm shutting up now.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Mar 2011 15:07:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61283#M15119</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-03-19T15:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61284#M15120</link>
      <description>&lt;P&gt;Thanks guys. In looking over streamstats, it seems like they should do what I'm looking for; but I must be to much of a noob to get anything out of them.&lt;/P&gt;

&lt;P&gt;My data is basically boolean, the value is either a 1 or a 0. I just want to fill in the blank rows with the previous 1 or 0. I can't believe this is the bottom!&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2011 03:32:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61284#M15120</guid>
      <dc:creator>keycoldstorage</dc:creator>
      <dc:date>2011-05-13T03:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61285#M15121</link>
      <description>&lt;P&gt;I think in simple terms what I want is the opposite of "dedup"! I deduped my logs by not generating redundant data; however, to more clearly view the data, I'd like to see all that duplication.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2011 04:08:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61285#M15121</guid>
      <dc:creator>keycoldstorage</dc:creator>
      <dc:date>2011-05-13T04:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61286#M15122</link>
      <description>&lt;P&gt;You definitely want streamstats instead of eventstats. Eventstats will get the aggregate 'last' over the entire set.  Streamstats will get the 'last' value up to (and including) the current position in the set.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2011 05:12:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61286#M15122</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-05-13T05:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61287#M15123</link>
      <description>&lt;P&gt;Got it, Thanks! Streamstats to the rescue! Here's a sample search that's working great:&lt;/P&gt;

&lt;P&gt;source=*Plant3.log CompB OR CompC_Pallette OR CompA OR CompD | streamstats last(CompA) as CompA_ last(CompB) as CompB_ last(CompC_Pallette) as CompC_ last(CompD) as CompD_&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:42:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61287#M15123</guid>
      <dc:creator>keycoldstorage</dc:creator>
      <dc:date>2020-09-28T09:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61288#M15124</link>
      <description>&lt;P&gt;Streamstats works great, up until the most recent event. It paints in the values as long as there are events to paint with; however, it leaves the values blank after the most recent event. Is there a way to sustain the most recent event in addition to the stream?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2011 23:12:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61288#M15124</guid>
      <dc:creator>keycoldstorage</dc:creator>
      <dc:date>2011-06-27T23:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61289#M15125</link>
      <description>&lt;P&gt;Streamstats look pretty damn close, but the last function evaluates in the wrong direction for my needs. I started another question based on my newfound knowledge and experience with it:  &lt;A href="http://splunk-base.splunk.com/answers/27725/change-the-evaluation-direction-of-streamstats"&gt;http://splunk-base.splunk.com/answers/27725/change-the-evaluation-direction-of-streamstats&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2011 05:52:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61289#M15125</guid>
      <dc:creator>keycoldstorage</dc:creator>
      <dc:date>2011-07-18T05:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61290#M15126</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| filldown
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Sep 2016 23:12:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61290#M15126</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2016-09-16T23:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61291#M15127</link>
      <description>&lt;P&gt;The SPL command &lt;STRONG&gt;filldown&lt;/STRONG&gt; is your friend.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=access_combined | filldown kbps | eventstats avg(kbps) as avgkbps by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.3/SearchReference/Filldown"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.3/SearchReference/Filldown&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2016 23:15:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61291#M15127</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2016-09-16T23:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61292#M15128</link>
      <description>&lt;P&gt;If you don't use filldown (answer below) then the correct answer is streamstats with current=false followed by coalesce.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 15:18:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61292#M15128</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2018-03-27T15:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61293#M15129</link>
      <description>&lt;P&gt;Use reverse before and after streamstats/filldown:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search&amp;gt; | reverse | streamstats last(&amp;lt;desired_field&amp;gt;) as &amp;lt;field_name&amp;gt; | reverse

or

&amp;lt;search&amp;gt; | reverse | filldown &amp;lt;desired_field&amp;gt; | reverse
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This was martin_mueller ♦'s way to fill in values including the most recent event.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 14:01:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61293#M15129</guid>
      <dc:creator>Nextbeat</dc:creator>
      <dc:date>2018-04-19T14:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Fillnull with previous known or conditional values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61294#M15130</link>
      <description>&lt;P&gt;Exactly what I was looking for! Thanks @landen99 &lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 12:14:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fillnull-with-previous-known-or-conditional-values/m-p/61294#M15130</guid>
      <dc:creator>richielynch89</dc:creator>
      <dc:date>2020-03-31T12:14:14Z</dc:date>
    </item>
  </channel>
</rss>

