<?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: Can you help me with my join query? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392667#M114221</link>
    <description>&lt;P&gt;This should be the search-&lt;BR /&gt;
index=IDX_A | rename srcip as dest_ip| map maxsearches=50000 search="search index=IDX_B dest_ip=$dest_ip$| eval url=\"$url$"\ "&lt;/P&gt;

&lt;P&gt;By default map returns 10000 results, you can increase the limit by adding maxsearches=&lt;/P&gt;

&lt;P&gt;Also if dest_ip needs to be escaped try with dest_ip= \"$dest_ip$"\&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 21:27:27 GMT</pubDate>
    <dc:creator>Vijeta</dc:creator>
    <dc:date>2020-09-29T21:27:27Z</dc:date>
    <item>
      <title>Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392657#M114211</link>
      <description>&lt;P&gt;I'm having trouble with a join query. It doesn't work with the inner or left join, although I can see the event from the left join, but without the fields from the other source.&lt;/P&gt;

&lt;P&gt;Let's say IDX_A contains an url and srcip. I want to join the srcip from IDX_A with the dest_ip from IDX_B. Here's a sample of the join query I'm trying to do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=IDX_A url = "http://some.url"
 | rename srcip as dest_ip
 | join dest_ip [search index=IDX_B]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can confirm that the main query and the subsearch, returns results when executed separately, however, the join returns 0 results.&lt;/P&gt;

&lt;P&gt;Any idea why this doesn't work? Seems pretty straight forward to me, but I can't get it to work.&lt;/P&gt;

&lt;P&gt;I saw some similar previous posts, but none of them were helpful for me.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:23:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392657#M114211</guid>
      <dc:creator>seomisp</dc:creator>
      <dc:date>2020-09-29T21:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392658#M114212</link>
      <description>&lt;P&gt;Are there common destination ip between the two index, can you share some sample data?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 15:12:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392658#M114212</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2018-09-26T15:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392659#M114213</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Have you tried using &lt;CODE&gt;max&lt;/CODE&gt; -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| join dest_ip max=0 [&amp;lt;subsearch&amp;gt;]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if it helps.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 15:18:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392659#M114213</guid>
      <dc:creator>Dawson014</dc:creator>
      <dc:date>2018-09-26T15:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392660#M114214</link>
      <description>&lt;P&gt;Dawson014, the max=0 didn't work.&lt;/P&gt;

&lt;P&gt;Vijeta,&lt;/P&gt;

&lt;P&gt;Here are two samples:&lt;/P&gt;

&lt;P&gt;For IDX_A:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; 08/07/2018 14:45:01 -0700, search_now=1533678300.000, info_search_time=1533678301.032, et="08/07/18 12:17:00", url="http://some.url", date_first="2018-07-07T18:27:55.000Z", srcip="34.196.13.28", _time=1533669420, count=1, ts_date_last="2018-07-07T18:44:34.000Z", ts_type=url
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For IDX_B:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"endtime":"2018-08-07T19:17:34.675657Z","timestamp":"2018-08-07T19:17:34.668258Z","bytes":1657,"bytes_in":442,"bytes_out":1215,"dest_ip":"34.196.13.28","dest_port":80,"http_comment":"HTTP/1.1 200 OK","http_content_length":897,"http_content_type":"text/html","http_method":"GET","src_ip":"10.230.36.142","status":200,"time_taken":9709,"transport":"tcp"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I removed some fields due to privacy concerns, but the important ones are there. I'm trying to join the event.ts_srcip with the dest_ip. As you can see the value is the same "34.196.13.28". I'm doing the query using a time range for the full day of 7th August 2018. Not sure if it matter the IDX_A raw event is plain text and IDX_B is json. I can still query both using the named fields, so they're being well parsed.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:27:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392660#M114214</guid>
      <dc:creator>seomisp</dc:creator>
      <dc:date>2020-09-29T21:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392661#M114215</link>
      <description>&lt;P&gt;Try this :-&lt;/P&gt;

&lt;P&gt;index=IDX_A url = "&lt;A href="http://some.url" target="_blank"&gt;http://some.url&lt;/A&gt;"  [search index=IDX_B| rename dest_ip as scrip| return scrip]&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:26:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392661#M114215</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2020-09-29T21:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392662#M114216</link>
      <description>&lt;P&gt;It doesn't work. It also doesn't make sense to rename dest_ip to srcip as it's the srcip from IDX_B that I want to get.&lt;BR /&gt;
The join query works if I add the an extra condition, like for example the URL's site to the subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=IDX_A url = "http://some.url"
| rename srcip as dest_ip
| join dest_ip [search index=IDX_B site=some.url]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it only works if the site is hardcoded. If I pass for example a rex field, it doesn't work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index=IDX_A url = "http://some.url"
    | rex field=url "^\w+:\/\/(?&amp;lt;rex_site&amp;gt;\S+?)\/(?&amp;lt;uri_path&amp;gt;.+)$"
    | rename srcip as dest_ip
    | join dest_ip [search index=IDX_B site=rex_site]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As the idea is to have this automated, the hardcoded solution is not optimal.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:23:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392662#M114216</guid>
      <dc:creator>seomisp</dc:creator>
      <dc:date>2020-09-29T21:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392663#M114217</link>
      <description>&lt;P&gt;You can try using map command -&lt;/P&gt;

&lt;P&gt;index=IDX_A | rename srcip as dest_ip| map search="search index=IDX_B dest_ip=$dest_ip$"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:26:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392663#M114217</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2020-09-29T21:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392664#M114218</link>
      <description>&lt;P&gt;The problem with map is that I lose the fields from the main search. The was the point of having a join.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 20:08:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392664#M114218</guid>
      <dc:creator>seomisp</dc:creator>
      <dc:date>2018-09-26T20:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392665#M114219</link>
      <description>&lt;P&gt;You can refer the fields you need from the main search in map search, for example to retain url&lt;/P&gt;

&lt;P&gt;index=IDX_A | rename srcip as dest_ip| map search="search index=IDX_B dest_ip=$dest_ip$"| eval url=\"$url$"\ "&lt;/P&gt;

&lt;P&gt;Also you can try using map on IDX_A and main index as IDX_B, so that all fields from IDX_A are retained without using eval.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:26:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392665#M114219</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2020-09-29T21:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392666#M114220</link>
      <description>&lt;P&gt;I get some weird results from map. Most of the times, I get:&lt;/P&gt;

&lt;P&gt;[map]: Search Processor: Subsearch produced 10000 results, truncating to maxout 10000.&lt;/P&gt;

&lt;P&gt;Which will then dump a bunch of results from indexes that are not even specified in the query.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 21:06:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392666#M114220</guid>
      <dc:creator>seomisp</dc:creator>
      <dc:date>2018-09-26T21:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392667#M114221</link>
      <description>&lt;P&gt;This should be the search-&lt;BR /&gt;
index=IDX_A | rename srcip as dest_ip| map maxsearches=50000 search="search index=IDX_B dest_ip=$dest_ip$| eval url=\"$url$"\ "&lt;/P&gt;

&lt;P&gt;By default map returns 10000 results, you can increase the limit by adding maxsearches=&lt;/P&gt;

&lt;P&gt;Also if dest_ip needs to be escaped try with dest_ip= \"$dest_ip$"\&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:27:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392667#M114221</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2020-09-29T21:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392668#M114222</link>
      <description>&lt;P&gt;I never used the map command much and seems very unstable. I increased the maxsearches but, still getting random results, sometimes it says it can't find the url attribute.&lt;/P&gt;

&lt;P&gt;I still don't understand why the join command doesn't work, it looks like a much cleaner solution.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 18:50:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392668#M114222</guid>
      <dc:creator>seomisp</dc:creator>
      <dc:date>2018-09-27T18:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392669#M114223</link>
      <description>&lt;P&gt;Agreed join is much appropriate in this context  and it should work.  Can you try using all time  with the join.  Also did you check the timestamp(_time) value for both the indexes . Logically I dont see any reason for join to not work  unless there is some parsing or timestamp issue&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 19:27:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392669#M114223</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2018-09-27T19:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392670#M114224</link>
      <description>&lt;P&gt;I tried with All Time. Same result, which is no match. I checked the _time fields of both indexes and the only difference is IDX_B has milliseconds, where IDX_A doesn't.&lt;/P&gt;

&lt;P&gt;One thing that doesn't make sense to me is that, if I put the url filter on the subsearch, the join works. However, I want to make this query generic and join all events from IDX_A with the matching ones from IDX_B. I'm just using the url filter now to test.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:24:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392670#M114224</guid>
      <dc:creator>seomisp</dc:creator>
      <dc:date>2020-09-29T21:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my join query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392671#M114225</link>
      <description>&lt;P&gt;I think the problem is because the subsearch exceeds the 50000 value:&lt;/P&gt;

&lt;P&gt;[subsearch]: Search Processor: Subsearch produced 50000 results, truncating to maxout 50000.&lt;/P&gt;

&lt;P&gt;That's when filtering it with the url it works, because it returns less events.&lt;/P&gt;

&lt;P&gt;Is there a way to workaround this?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 21:05:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-my-join-query/m-p/392671#M114225</guid>
      <dc:creator>seomisp</dc:creator>
      <dc:date>2018-09-27T21:05:36Z</dc:date>
    </item>
  </channel>
</rss>

