<?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: How to combine my two search queries using join or subsearch? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192993#M55511</link>
    <description>&lt;P&gt;because this is not the answer to your question I will post it as comment:&lt;/P&gt;

&lt;P&gt;Maybe you will have a look at this answer &lt;A href="http://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html"&gt;http://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html&lt;/A&gt; to get an idea how to do it without the use of &lt;CODE&gt;join&lt;/CODE&gt; or any &lt;CODE&gt;subsearch&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Nov 2014 11:33:26 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2014-11-04T11:33:26Z</dc:date>
    <item>
      <title>How to combine my two search queries using join or subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192989#M55507</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have 2 queries which do not have anything in common, how ever i wish to join them can somebody help :&lt;/P&gt;

&lt;P&gt;query 1 :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=whatever* tms_action="*someaction*"| rex "'(?[^']+)\s*' .*"| table userhandle tms_blob_type
| join userhandle [search index=summary source=*Username* 
| table userhandle user company]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;query 2:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=whatever* sourcetype=server "_DATE_FROM_IN =*" "*_DATE_TO_IN =*" |REGEX _DATE_TO_IN ="'\d+'" | rex field= "_DATE_FROM_IN (?&amp;lt;_DATE_FROM_IN&amp;gt;.*)"|rex field= "_DATE_TO_IN (?&amp;lt;_DATE_TO_IN&amp;gt;.*)"| table _DATE_TO_IN _DATE_FROM_IN
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The only way to manually join them is as shown below over the userhandle field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=whatever2 _threadid=12128 host=whatever18 Starting handle blob earliest=1415036143.447343 latest=1415036623.447343 | eval tdiff=_time-strptime("2014november3 17:39:43.447343","%Y%B%e %H:%M:%S.%6N")  | search tdiff&amp;lt;0  | sort -tdiff  | head 1  | rex field=_raw " for '(?[^']*)'"  | rename _blob_type  AS ThreadAction  | table _time userhandle ThreadAction
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;is there a way to do it by a join or subquery or something ?&lt;/P&gt;

&lt;P&gt;Plesae help.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Nov 2014 18:07:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192989#M55507</guid>
      <dc:creator>allladin101</dc:creator>
      <dc:date>2014-11-03T18:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine my two search queries using join or subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192990#M55508</link>
      <description>&lt;P&gt;Try this,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=whatever* (sourcetype=server "_DATE_FROM_IN =*" "*_DATE_TO_IN =*") OR (tms_action="*someaction*")  | rex "'(?[^']+)\s*' .*" |REGEX _DATE_TO_IN ="'\d+'" | rex field= "_DATE_FROM_IN (?&amp;lt;_DATE_FROM_IN&amp;gt;.*)"|rex field= "_DATE_TO_IN (?&amp;lt;_DATE_TO_IN&amp;gt;.*)"  | table userhandle tms_blob_type _DATE_TO_IN _DATE_FROM_IN  | join userhandle [search index=summary source=*Username* | table userhandle user company]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Nov 2014 20:18:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192990#M55508</guid>
      <dc:creator>vasanthmss</dc:creator>
      <dc:date>2014-11-03T20:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine my two search queries using join or subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192991#M55509</link>
      <description>&lt;P&gt;It says that - Error in 'rex' command: Encountered the following error while compiling the regex ''(?[^']+)\s*' .*': Regex: unrecognized character after (? or (?-&lt;/P&gt;

&lt;P&gt;also the query is not returning a table .. please help&lt;/P&gt;

&lt;P&gt;even this part is not working :&lt;/P&gt;

&lt;P&gt;index=tms_uat* (sourcetype=tms_server "DEAL_DATE_FROM_IN =&lt;EM&gt;" "*DEAL_DATE_TO_IN =&lt;/EM&gt;") OR (tms_action="&lt;EM&gt;DS::QueryDealMessage3&lt;/EM&gt;")   |rex "'(?['^']+)\s*' .&lt;EM&gt;"|REGEX DEAL_DATE_TO_IN ="'\d+'" | rex field= "DEAL_DATE_FROM_IN (?.&lt;/EM&gt;)"|rex field= "DEAL_DATE_TO_IN (?.*)"  | table ULH tms_blob_type DEAL_DATE_TO_IN DEAL_DATE_FROM_IN &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:04:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192991#M55509</guid>
      <dc:creator>allladin101</dc:creator>
      <dc:date>2020-09-28T18:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine my two search queries using join or subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192992#M55510</link>
      <description>&lt;P&gt;Is there something missing from the rex command you posted in query1 in the original question? &lt;/P&gt;

&lt;P&gt;I think the supplied answer is trying to use the same rex command as shown in query 1 from the original question. &lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2014 11:20:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192992#M55510</guid>
      <dc:creator>davebrooking</dc:creator>
      <dc:date>2014-11-04T11:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine my two search queries using join or subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192993#M55511</link>
      <description>&lt;P&gt;because this is not the answer to your question I will post it as comment:&lt;/P&gt;

&lt;P&gt;Maybe you will have a look at this answer &lt;A href="http://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html"&gt;http://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html&lt;/A&gt; to get an idea how to do it without the use of &lt;CODE&gt;join&lt;/CODE&gt; or any &lt;CODE&gt;subsearch&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2014 11:33:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192993#M55511</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-11-04T11:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine my two search queries using join or subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192994#M55512</link>
      <description>&lt;P&gt;try to use this subsearch in your search string&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=whatever* tms_action="*someaction*"| rex "'(?P&amp;lt;FIELDNAME&amp;gt;[^']+)\s*' .*"| join userhandle [search index=summary source=*Username*]|join [search  index=whatever* sourcetype=server "_DATE_FROM_IN =*" "*_DATE_TO_IN =*" |rex   "(?P&amp;lt;DATE_TO_IN&amp;gt;)'\d+'" | rex field=DATE_TO_IN  "_DATE_FROM_IN (?&amp;lt;_DATE_FROM_IN&amp;gt;.*)"|table  userhandle user company _DATE_TO_IN _DATE_FROM_IN
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Dec 2014 11:15:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192994#M55512</guid>
      <dc:creator>tachifelix</dc:creator>
      <dc:date>2014-12-12T11:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine my two search queries using join or subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192995#M55513</link>
      <description>&lt;P&gt;You are trying to add it to a dashboard.  Instead of "&amp;lt;" and "&amp;gt;" user "&amp;lt;" and "&amp;gt;"&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 17:11:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-my-two-search-queries-using-join-or-subsearch/m-p/192995#M55513</guid>
      <dc:creator>lakromani</dc:creator>
      <dc:date>2016-10-12T17:11:18Z</dc:date>
    </item>
  </channel>
</rss>

