<?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: Lookup Update Table Unique Rows in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Lookup-Update-Table-Unique-Rows/m-p/492993#M137498</link>
    <description>&lt;P&gt;each &lt;EM&gt;app&lt;/EM&gt; may be multivalues?&lt;/P&gt;</description>
    <pubDate>Sun, 10 May 2020 21:25:16 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-05-10T21:25:16Z</dc:date>
    <item>
      <title>Lookup Update Table Unique Rows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-Update-Table-Unique-Rows/m-p/492992#M137497</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;

&lt;P&gt;I'm trying to build a lookup table that will update based on the latest time a user logged into a particular application. Ideally, it has a few tracking columns at the end to track last updated and first added. Something like the table that follows. Date added would be the date the user had first logged into &lt;EM&gt;any&lt;/EM&gt; application. Not all users use all applications. Lastupdate should always equal the latest date in one of the application columns. The table below should hopefully self-explain the desired outcome.&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;UserID,app1,app2,app3,app4,DateAdded,LatestLogin&lt;BR /&gt;
Jdoe,05/06/20,,,03/04/20,02/02/20,05/06/20&lt;BR /&gt;
Ksmith,,04/20/20,,,01/15/20,04/20/20&lt;BR /&gt;
Jfrank,,,03/03/20,,03/03/20,03/03/20&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Each user would only appear once, and we would only update where they had an application login. We've been able to successfully append the lookup using a combination of input and outputlookup but unable to modify a specific row.&lt;/P&gt;

&lt;P&gt;We created the following to build it (And added an "inlist" column that says "True" based on other examples) but are struggling to 'update' once built.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| multisearch
    [| search index=app1 status=success userid=*
    | rename _time as app1]

    [| search index=app2 status=success userid=*
    | rename _time as app2]

    [| search index=app3 status=success userid=*
    | rename _time as app3]

    [| search index=app4 status=success userid=*
    | rename _time as app4]

    | stats
    values(userid) as userid
    values(app1) as app1
    values(app2) as app2
    values(app3) as app3
    values(app4) as app4
    by userid
    | convert timeformat="%m/%d/%Y" ctime(app1) ctime(app2) ctime(app3) ctime(app4)
    | fillnull value=true inlist
    | table userid inlist app1 app2 app3 app4
    | outputlookup appaccess.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you in advance, as always.&lt;/P&gt;

&lt;P&gt;Finally, Happy Mothers Day!&lt;/P&gt;</description>
      <pubDate>Sun, 10 May 2020 13:55:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-Update-Table-Unique-Rows/m-p/492992#M137497</guid>
      <dc:creator>antb</dc:creator>
      <dc:date>2020-05-10T13:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup Update Table Unique Rows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-Update-Table-Unique-Rows/m-p/492993#M137498</link>
      <description>&lt;P&gt;each &lt;EM&gt;app&lt;/EM&gt; may be multivalues?&lt;/P&gt;</description>
      <pubDate>Sun, 10 May 2020 21:25:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-Update-Table-Unique-Rows/m-p/492993#M137498</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-10T21:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup Update Table Unique Rows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-Update-Table-Unique-Rows/m-p/492994#M137499</link>
      <description>&lt;P&gt;Do your searches, then read in the lookup file in append mode.  Remove duplicates (using &lt;CODE&gt;stats&lt;/CODE&gt; in this example).  Write the results to the lookup file.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| multisearch 
...
| inputlookup append=true appaccess.csv
| stats latest(app1) as app1, latest(app2) as app2, latest(app3) as app3, latest(app4) as app4 by userid
| eval lastLogin = max(app1, app2, app3, app4)
| convert ...
| table userid, app1, app2, app3, app4, lastLogin
| outputlookup appaccess.csv
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 May 2020 23:38:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-Update-Table-Unique-Rows/m-p/492994#M137499</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-05-10T23:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup Update Table Unique Rows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-Update-Table-Unique-Rows/m-p/492995#M137500</link>
      <description>&lt;P&gt;no - that was heldover from a different query. I'm all set thanks to @richgalloway &lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 16:23:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-Update-Table-Unique-Rows/m-p/492995#M137500</guid>
      <dc:creator>antb</dc:creator>
      <dc:date>2020-05-11T16:23:38Z</dc:date>
    </item>
  </channel>
</rss>

