<?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 dynamically fill null values with the last known field value based on the results of search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-dynamically-fill-null-values-with-the-last-known-field/m-p/248544#M74210</link>
    <description>&lt;P&gt;That worked.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jul 2016 19:01:42 GMT</pubDate>
    <dc:creator>jtuni</dc:creator>
    <dc:date>2016-07-07T19:01:42Z</dc:date>
    <item>
      <title>How to dynamically fill null values with the last known field value based on the results of search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-dynamically-fill-null-values-with-the-last-known-field/m-p/248540#M74206</link>
      <description>&lt;P&gt;I have log data that doesn't always contain a user ID, but I would like to fill the user ID field with the last known user ID. I am using the streamstats command successfully to do this, but only AFTER there is a user ID to associate to the data. What I would like to do is to take that association and apply it to events that were reviewed prior to that association.&lt;/P&gt;

&lt;P&gt;event logs look something like this&lt;/P&gt;

&lt;P&gt;ip=1.1.1.1 url=answers.splunk.com&lt;BR /&gt;
ip=1.1.1.1 url=answers.splunk.com&lt;BR /&gt;
ip=1.1.1.1 userid=user1 url=answers.splunk.com&lt;BR /&gt;
ip=1.1.1.1 url=answers.splunk.com&lt;BR /&gt;
ip=2.2.2.2 url=answers.splunk.com&lt;BR /&gt;
ip=2.2.2.2 userid=user2 url=answers.splunk.com&lt;BR /&gt;
ip=2.2.2.2 url=answers.splunk.com&lt;/P&gt;

&lt;P&gt;My search is this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search url=answers.splunk.com | streamstats current=f window=0 global=f last(userid) as last_userid by ip | stats count by last_userid, ip, url
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and my results would be&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;last_userid    ip          url                    count
user1          1.1.1.1     answers.splunk.com     2
user2          2.2.2.2     answers.splunk.com     2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and the results that were prior to the first event log with a userid in it don't get calculated into the result. I need to associated the userid to those events as well.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 18:19:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-dynamically-fill-null-values-with-the-last-known-field/m-p/248540#M74206</guid>
      <dc:creator>jtuni</dc:creator>
      <dc:date>2016-07-07T18:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamically fill null values with the last known field value based on the results of search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-dynamically-fill-null-values-with-the-last-known-field/m-p/248541#M74207</link>
      <description>&lt;P&gt;Try &lt;CODE&gt;filldown&lt;/CODE&gt; command &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Filldown"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Filldown&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | filldown user_id | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If that doesn't work, try &lt;CODE&gt;eventstats&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 18:43:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-dynamically-fill-null-values-with-the-last-known-field/m-p/248541#M74207</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-07T18:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamically fill null values with the last known field value based on the results of search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-dynamically-fill-null-values-with-the-last-known-field/m-p/248542#M74208</link>
      <description>&lt;P&gt;With this works for you&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search url=answers.splunk.com | eventstats values(userid) as last_userid by ip | stats count by last_userid, ip, url
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jul 2016 18:53:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-dynamically-fill-null-values-with-the-last-known-field/m-p/248542#M74208</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-07-07T18:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamically fill null values with the last known field value based on the results of search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-dynamically-fill-null-values-with-the-last-known-field/m-p/248543#M74209</link>
      <description>&lt;P&gt;I did not try the filldown command. I'm not sure if that will work, but I will try using it to see what sort of results I do get from it. However using eventstats instead of streamstats resolved my issue, thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 19:01:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-dynamically-fill-null-values-with-the-last-known-field/m-p/248543#M74209</guid>
      <dc:creator>jtuni</dc:creator>
      <dc:date>2016-07-07T19:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamically fill null values with the last known field value based on the results of search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-dynamically-fill-null-values-with-the-last-known-field/m-p/248544#M74210</link>
      <description>&lt;P&gt;That worked.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 19:01:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-dynamically-fill-null-values-with-the-last-known-field/m-p/248544#M74210</guid>
      <dc:creator>jtuni</dc:creator>
      <dc:date>2016-07-07T19:01:42Z</dc:date>
    </item>
  </channel>
</rss>

