<?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 match in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357441#M105726</link>
    <description>&lt;P&gt;Got it .. I used makemv instead ...&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2018 09:04:00 GMT</pubDate>
    <dc:creator>robettinger</dc:creator>
    <dc:date>2018-02-08T09:04:00Z</dc:date>
    <item>
      <title>Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357427#M105712</link>
      <description>&lt;P&gt;Hi, I am trying to do the following:&lt;/P&gt;

&lt;P&gt;1 - Search an index;&lt;BR /&gt;
2 - For each result, search for matches in lookup table 1, based on the timestamp, in 1 hour bins.&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;P&gt;Step 1 - [base search] | eval Period=day + ' - ' + hour&lt;/P&gt;

&lt;P&gt;Result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; User      Period
User1     Monday - 11
User2     Monday - 12
User3     Monday - 09
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Step 2 - Match each user and period against a lookup and populate a list (can be multi-value) with hits&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;User       Period             Hits
User1     Monday - 11     No hits
User2     Monday - 12     05/02/18 12:02:45
                          05/02/18 12:44:13
User3     Monday - 09     05/02/18 09:28:15
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I achieve this? The lookup table has only User and a Timestamp, the 'Period' field is calculated. How can I do the "...For each result on Step1, search the lookup table, and if hits found, list it alongside the row ...&lt;/P&gt;

&lt;P&gt;Not sure if this is clear enough ...&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 09:12:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357427#M105712</guid>
      <dc:creator>robettinger</dc:creator>
      <dc:date>2018-02-06T09:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357428#M105713</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [base search] | eval Period=day + ' - ' + hour|lookup &amp;lt;lookupname&amp;gt; User OUTPUT Hits
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here lookup command will join using User as primary field and gives output as Hits..&lt;BR /&gt;
If this doesnt work then try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[base search] | eval Period=day + ' - ' + hour|join User[|inputlookup &amp;lt;lookupname&amp;gt;|stats values(Hits) by User]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Feb 2018 09:23:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357428#M105713</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-06T09:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357429#M105714</link>
      <description>&lt;P&gt;You can use a time-based kvstore lookup. This will compare the event time with the defined time field in the kvstore. A useful primer would be the previously questions answers here on this forum: &lt;A href="https://answers.splunk.com/answers/209693/time-based-lookups-and-kvstore.html"&gt;https://answers.splunk.com/answers/209693/time-based-lookups-and-kvstore.html&lt;/A&gt; for example. &lt;/P&gt;

&lt;P&gt;However if your event time differs from the hourly digit in your table, you should try to modify your _time value before doing the lookup. &lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 09:26:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357429#M105714</guid>
      <dc:creator>bojanisch</dc:creator>
      <dc:date>2018-02-06T09:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357430#M105715</link>
      <description>&lt;P&gt;hey you can try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ base search]
| stats count by User 
| table User
| lookup &amp;lt;mylookup.csv&amp;gt; User OUTPUT hits 
| eval Period=strftime(strptime(hits,"%d/%m/%y %H:%M:%S"),"%A - %H")
| fillnull Period value="No hits"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 10:03:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357430#M105715</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-02-06T10:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357431#M105716</link>
      <description>&lt;P&gt;Unfortunately the lookup doesn't have a Period field, I have to calculate it AFTER the lookup &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 10:09:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357431#M105716</guid>
      <dc:creator>robettinger</dc:creator>
      <dc:date>2018-02-06T10:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357432#M105717</link>
      <description>&lt;P&gt;This works partially ... It only populates a table if there are hits in the lookup table. If there arent, the events are show in the "events" tabs, but no table is displayed, despite the fact I used the "table" command.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 10:17:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357432#M105717</guid>
      <dc:creator>robettinger</dc:creator>
      <dc:date>2018-02-06T10:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357433#M105718</link>
      <description>&lt;P&gt;try like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[base search] | eval Period=day + ' - ' + hour|join User[|inputlookup &amp;lt;lookupname&amp;gt;|fillnull|stats values(Hits) by User]|table ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Feb 2018 10:24:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357433#M105718</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-06T10:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357434#M105719</link>
      <description>&lt;P&gt;i have changed my query please check and let me know.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 10:40:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357434#M105719</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-02-06T10:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357435#M105720</link>
      <description>&lt;P&gt;nope ... it is still discarding the rows which are NOT in the lookup table ... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 13:02:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357435#M105720</guid>
      <dc:creator>robettinger</dc:creator>
      <dc:date>2018-02-06T13:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357436#M105721</link>
      <description>&lt;P&gt;try left join :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[base search] | eval Period=day + ' - ' + hour|join type=left User[|inputlookup &amp;lt;lookupname&amp;gt;|fillnull|stats values(Hits) by User]|table ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Feb 2018 13:05:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357436#M105721</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-06T13:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357437#M105722</link>
      <description>&lt;P&gt;Ok. I solved the issue with the items not in the lookup table by changing the join type from inner to left (duh, lol), but one last question: how can I have a multivalue field when I join searches? Currently there is a 1-2-1 relationship and I would like a 1-2-many...&lt;/P&gt;

&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 07:59:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357437#M105722</guid>
      <dc:creator>robettinger</dc:creator>
      <dc:date>2018-02-07T07:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357438#M105723</link>
      <description>&lt;P&gt;try mvexpand:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[base search] | eval Period=day + ' - ' + hour|join type=left User[|inputlookup &amp;lt;lookupname&amp;gt;|fillnull|stats values(Hits) as Hits by User|mvexpand Hits ]|table ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Feb 2018 08:08:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357438#M105723</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-07T08:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357439#M105724</link>
      <description>&lt;P&gt;Nope... if I put the mvexpand INSIDE the join subquery, it separates a hit per row, causing a 1-2-1 relationship, and if I put the mvexpand OUTSIDE the subquery, it shows all values in a single row, but flattened:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Inside:
User Hits
1        a
1        b
1        c

Outside:
User Hits
1     a b c

I would like:

1     a
       b
       c
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Feb 2018 08:40:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357439#M105724</guid>
      <dc:creator>robettinger</dc:creator>
      <dc:date>2018-02-08T08:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357440#M105725</link>
      <description>&lt;P&gt;I am afraid not. I think the solution is probably achieved using a join instead of a lookup... I may be wrong, though.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 08:43:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357440#M105725</guid>
      <dc:creator>robettinger</dc:creator>
      <dc:date>2018-02-08T08:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357441#M105726</link>
      <description>&lt;P&gt;Got it .. I used makemv instead ...&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 09:04:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Lookup-match/m-p/357441#M105726</guid>
      <dc:creator>robettinger</dc:creator>
      <dc:date>2018-02-08T09:04:00Z</dc:date>
    </item>
  </channel>
</rss>

