<?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: Join with multiple matches in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-multiple-matches/m-p/592083#M206114</link>
    <description>&lt;P&gt;Well, yes. Stats will be slower than lookup since lookup works completely differently.&lt;/P&gt;&lt;P&gt;I'm a bit puzzled though why you fool around with RDP_Event_time since it should be the same as _time and you're statsing over it anyway.&lt;/P&gt;</description>
    <pubDate>Sun, 03 Apr 2022 12:50:37 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2022-04-03T12:50:37Z</dc:date>
    <item>
      <title>How to join with multiple matches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-multiple-matches/m-p/592054#M206101</link>
      <description>&lt;P&gt;Im trying to join the correct source hostname to my Event from where a RDP Connection was innitiated.&lt;BR /&gt;Since the Event just provides the Source IP-Address, I want to join the hostname from my summary Index that has hostnames with the IP-Addresses which they have been assigned to over time (1m Bucket)&lt;/P&gt;
&lt;P&gt;Unfortunately its not working as expected.&lt;/P&gt;
&lt;P&gt;I build the search as following:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;search string for RDP Logon Event&amp;gt;
| bucket span=1m _time
| join type=left
[search index=&amp;lt;summary_index&amp;gt; 
| eval source_host = hostname
| eval Source_Network_Address = IP
| fields _time Source_Network_Address source_host]

| table _time host source_host Source_Network_Address&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now what happens is, that the Source_Network_Addresses are getting matched, but it only returns the latest _time value from the summary_index by the matched Network Address for all, which ofc mostly results in a wrong hostname&lt;/P&gt;
&lt;P&gt;Why is it not also matching the _time value from the base search with the _time value from the subsearch?&lt;/P&gt;
&lt;P&gt;both _time fields are in timestamp format&lt;/P&gt;
&lt;P&gt;Thanks for helping me&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 14:41:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-multiple-matches/m-p/592054#M206101</guid>
      <dc:creator>Hendrik2509</dc:creator>
      <dc:date>2022-04-04T14:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Join with multiple matches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-multiple-matches/m-p/592056#M206103</link>
      <description>&lt;P&gt;That's not how you do it. Splunk is not a RDBMS &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Normal approach to such task is to list all events with overlapping fields on which you want to aggregate events and do some groupping with stats command.&lt;/P&gt;&lt;P&gt;For example - a rough idea if you want to "join" on source_ip:&lt;/P&gt;&lt;PRE&gt;(&amp;lt;search for RDP events&amp;gt;) OR (&amp;lt;search for summary events&amp;gt;)|&amp;nbsp; eval summary_source_hostname=if(index="summary",hostname,null())| eval source_ip=if(index="summary",Source_Network_Address,source_ip_field_from_rdp_connection)&lt;BR /&gt;| bin _time span=1m&lt;BR /&gt;| stats values(summary_source_ip) values(rdp_username) by source_ip _time&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 10:25:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-multiple-matches/m-p/592056#M206103</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-04-02T10:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: Join with multiple matches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-multiple-matches/m-p/592057#M206104</link>
      <description>&lt;P&gt;Fields that begin with underscore e.g. _time are hidden from field lists unless explicitly included. Try it like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search string for RDP Logon Event&amp;gt;
| bucket span=1m _time
| join type=left _time Source_Network_Address
[search index=&amp;lt;summary_index&amp;gt; 
| eval source_host = hostname
| eval Source_Network_Address = IP
| fields _time Source_Network_Address source_host]

| table _time host source_host Source_Network_Address&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 02 Apr 2022 10:28:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-multiple-matches/m-p/592057#M206104</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-02T10:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: Join with multiple matches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-multiple-matches/m-p/592069#M206110</link>
      <description>&lt;P&gt;thanks, I have changed it to this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="css"&gt;(&amp;lt;RDP_Event_Search&amp;gt;) OR (&amp;lt;summary_index&amp;gt;)
| bucket span=1m _time
| eval host = if(index=&amp;lt;RDP_Events&amp;gt;,host,null())
| eval Source_Network_Address = if(index=&amp;lt;summary_index&amp;gt;,IP,Source_Network_Address)
| eval RDP_Event_time = if(EventCode=21,_time,null())
| stats values(hostname) as source_hostname values(host) as dest_host values(RDP_Event_time) as RDP_Event_time by Source_Network_Address _time
| where RDP_Event_time=_time
| convert ctime(RDP_Event_time)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works now, but the search is quiet slow though.&lt;/P&gt;&lt;P&gt;I created a kvstore from my summary_index and tried a lookup, which turned out to be a lot faster.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="css"&gt;&amp;lt;RDP_Event_Search&amp;gt;
| bucket span=1m _time
| lookup &amp;lt;lookup_name&amp;gt; IP as Source_Network_Address _time as _time OUTPUT hostname as source_hostname 
| table _time host source_hostname Source_Network_Address
| where isnotnull(source_hostname)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, changing to a kvstore would result in a continuously grow of plus &amp;gt;1.000.000 rows per day, are there any size limit recommendations for kvstores and lookup-queries?&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 20:12:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-multiple-matches/m-p/592069#M206110</guid>
      <dc:creator>Hendrik2509</dc:creator>
      <dc:date>2022-04-02T20:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Join with multiple matches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-multiple-matches/m-p/592083#M206114</link>
      <description>&lt;P&gt;Well, yes. Stats will be slower than lookup since lookup works completely differently.&lt;/P&gt;&lt;P&gt;I'm a bit puzzled though why you fool around with RDP_Event_time since it should be the same as _time and you're statsing over it anyway.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2022 12:50:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-multiple-matches/m-p/592083#M206114</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-04-03T12:50:37Z</dc:date>
    </item>
  </channel>
</rss>

