<?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: Search and lookup table fields comparison in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-and-lookup-table-fields-comparison/m-p/487585#M142974</link>
    <description>&lt;P&gt;worked like a charm!&lt;/P&gt;

&lt;P&gt;Grazie&lt;/P&gt;</description>
    <pubDate>Thu, 05 Mar 2020 11:31:15 GMT</pubDate>
    <dc:creator>DomenicoFumarol</dc:creator>
    <dc:date>2020-03-05T11:31:15Z</dc:date>
    <item>
      <title>Search and lookup table fields comparison</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-and-lookup-table-fields-comparison/m-p/487583#M142972</link>
      <description>&lt;P&gt;Hello everyone,&lt;BR /&gt;I have the challenge to compare two date fields, one coming from a search and the other one is reported in a lookup table. Of these two dates I would like to get the most recent one.&lt;BR /&gt;Let's say that the search can give me the "last time a specific user came into our shop" and in the lookup table instead we report "last time the user bought something in our shop"&lt;BR /&gt;Assuming that the two dates always exist, I would like to get the most recent of the twos.&lt;/P&gt;
&lt;P&gt;Appreciated your help.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 22:44:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-and-lookup-table-fields-comparison/m-p/487583#M142972</guid>
      <dc:creator>DomenicoFumarol</dc:creator>
      <dc:date>2020-07-23T22:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Search and lookup table fields comparison</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-and-lookup-table-fields-comparison/m-p/487584#M142973</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/198625"&gt;@DomenicoFumarol&lt;/a&gt;a,&lt;BR /&gt;
I haven't your logs, so I put some assumptions:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;the field in search is last_time_1&lt;/LI&gt;
&lt;LI&gt;the column in lookup is last_time_2&lt;/LI&gt;
&lt;LI&gt;please, don't use (if possible) fields with spaces!&lt;/LI&gt;
&lt;LI&gt;the time format is the same in both search and lookup and it's yyyy-mm-dd hh:mm:ss&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;So I can suppose something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index
| lookup your_lookup.csv user OUTPUT last_time_2
| eval last_time_1=strptime(last_time_1,"%Y-%m-%d %H:%M:%S"), last_time_2=strptime(last_time_2,"%Y-%m-%d %H:%M:%S")
| stats latest(last_time_1) AS last_time_1 latest(last_time_2) AS last_time_2 BY user
| eval recent=if(last_time_1&amp;gt;last_time_2,last_time_1,last_time_2)
| table user recent
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:28:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-and-lookup-table-fields-comparison/m-p/487584#M142973</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-30T04:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Search and lookup table fields comparison</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-and-lookup-table-fields-comparison/m-p/487585#M142974</link>
      <description>&lt;P&gt;worked like a charm!&lt;/P&gt;

&lt;P&gt;Grazie&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 11:31:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-and-lookup-table-fields-comparison/m-p/487585#M142974</guid>
      <dc:creator>DomenicoFumarol</dc:creator>
      <dc:date>2020-03-05T11:31:15Z</dc:date>
    </item>
  </channel>
</rss>

