<?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: joining two searches with common field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91306#M23480</link>
    <description>&lt;P&gt;Yes, transaction can link on two (or more) fields:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0/SearchReference/Transaction"&gt;http://docs.splunk.com/Documentation/Splunk/6.0/SearchReference/Transaction&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Oct 2013 12:52:28 GMT</pubDate>
    <dc:creator>sowings</dc:creator>
    <dc:date>2013-10-10T12:52:28Z</dc:date>
    <item>
      <title>joining two searches with common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91301#M23475</link>
      <description>&lt;P&gt;I'm not an advanced user of splunk, so I'm not even sure this is possible. I have two searches which have a common field say, "host" in two events (one from each search). The event time from both searches occurs within 20 seconds of each other. Is it possible to use the common field, "host" to join the two events (from the two search results) together within 20 seconds of either event. Hope that makes sense.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2013 18:40:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91301#M23475</guid>
      <dc:creator>allen_edmondson</dc:creator>
      <dc:date>2013-10-09T18:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: joining two searches with common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91302#M23476</link>
      <description>&lt;P&gt;1) You can use join with an "outer" search and a subsearch:&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;first_search&lt;/EM&gt; | join host [ &lt;EM&gt;second_search&lt;/EM&gt; ]&lt;/P&gt;

&lt;P&gt;2) But you probably don't have to do them as separate searches. You can group your search terms with an OR to match them all at once. Let's say my first_search above is "sourcetype=syslog "session start"" and my second_search is "sourcetype=syslog "session end"", I could combine these (recognizing the common bits) as "sourcetype=syslog session (start OR end)". Then, both events are present in the same result set.&lt;/P&gt;

&lt;P&gt;If you can provide some more details about your searches, we can probably provide some clearer hints on how you might approach the problem.&lt;/P&gt;

&lt;P&gt;tl;dr: Yes, you can join result sets together.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2013 19:08:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91302#M23476</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2013-10-09T19:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: joining two searches with common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91303#M23477</link>
      <description>&lt;P&gt;I would recommend approach 2), since &lt;CODE&gt;join&lt;/CODE&gt;s are quite expensive performance-wise. We know too little of your actual desires (!) but perhaps a &lt;CODE&gt;transaction&lt;/CODE&gt; could be what you're after;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=X OR sourcetype=Y other_search_terms | transaction host maxpause=30s | blah blah
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If events with the same &lt;CODE&gt;host&lt;/CODE&gt; value are no more than 30 seconds apart, they will form a transaction, which essentially is the participating events bolted together chronologically.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;transaction&lt;/CODE&gt; is faster than &lt;CODE&gt;join&lt;/CODE&gt;, but &lt;CODE&gt;stats&lt;/CODE&gt; is even faster. Depending on your use case, perhaps that can be used.&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2013 19:43:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91303#M23477</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-10-09T19:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: joining two searches with common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91304#M23478</link>
      <description>&lt;P&gt;Thanks Kristian, Is it possible to use transaction on two fields, eg "hosts" &amp;amp; "hosts2" whereby it is the data in both fields which is the same, and it is that which I wish to correlate?&lt;/P&gt;

&lt;P&gt;Also, Both searches are different indexes&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 10:26:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91304#M23478</guid>
      <dc:creator>allen_edmondson</dc:creator>
      <dc:date>2013-10-10T10:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: joining two searches with common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91305#M23479</link>
      <description>&lt;P&gt;Searches in different indexes are no problem; you can arrange the search terms with OR there as well, e.g. &lt;CODE&gt;(index=os OR index=linux)&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 12:24:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91305#M23479</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2013-10-10T12:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: joining two searches with common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91306#M23480</link>
      <description>&lt;P&gt;Yes, transaction can link on two (or more) fields:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0/SearchReference/Transaction"&gt;http://docs.splunk.com/Documentation/Splunk/6.0/SearchReference/Transaction&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 12:52:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91306#M23480</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2013-10-10T12:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: joining two searches with common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91307#M23481</link>
      <description>&lt;P&gt;Thanks for your help. I have joined two searches by index, with some success. However, I have noticed that one of the fields in the second search, does not always show the correct value. Is it possible to join the two searches, based on the join criteria within 60 seconds of the time of either log. This would solve my problem!&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2013 16:44:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/joining-two-searches-with-common-field/m-p/91307#M23481</guid>
      <dc:creator>allen_edmondson</dc:creator>
      <dc:date>2013-10-21T16:44:54Z</dc:date>
    </item>
  </channel>
</rss>

