<?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 do you create a subsearch for two correlated queries? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-subsearch-for-two-correlated-queries/m-p/380146#M111287</link>
    <description>&lt;P&gt;I'm seeking assistance with writing the 2 queries&lt;/P&gt;</description>
    <pubDate>Thu, 08 Nov 2018 21:38:25 GMT</pubDate>
    <dc:creator>princeali</dc:creator>
    <dc:date>2018-11-08T21:38:25Z</dc:date>
    <item>
      <title>How do you create a subsearch for two correlated queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-subsearch-for-two-correlated-queries/m-p/380144#M111285</link>
      <description>&lt;P&gt;Query One: One that is exclusive of Server4 in Index1 based of the hosts in Index2.  I.e. based on the Index2 hosts, I run a query on Index1 and only show the same hosts, Server1–Server3.&lt;/P&gt;

&lt;P&gt;Query Two: This one is exclusive of any hosts that are in Index2 when we run a search in Index1.  I.e. based on the Index2 hosts I run a query on Index1 and it only shows the host Server4.&lt;/P&gt;

&lt;P&gt;P.S. - This is an enterprise class system and the hostnames columns are a moving target and also the hostnames are different fieldnames&lt;/P&gt;

&lt;P&gt;Index1&lt;BR /&gt;
-Server1&lt;BR /&gt;
-Server2&lt;BR /&gt;
-Server3&lt;BR /&gt;
-Server4&lt;/P&gt;

&lt;P&gt;Index2&lt;BR /&gt;
-Server1&lt;BR /&gt;
-Server2&lt;BR /&gt;
-Server3&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 13:56:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-subsearch-for-two-correlated-queries/m-p/380144#M111285</guid>
      <dc:creator>princeali</dc:creator>
      <dc:date>2018-11-08T13:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a subsearch for two correlated queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-subsearch-for-two-correlated-queries/m-p/380145#M111286</link>
      <description>&lt;P&gt;could you share the two queries? &lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 20:09:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-subsearch-for-two-correlated-queries/m-p/380145#M111286</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-11-08T20:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a subsearch for two correlated queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-subsearch-for-two-correlated-queries/m-p/380146#M111287</link>
      <description>&lt;P&gt;I'm seeking assistance with writing the 2 queries&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 21:38:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-subsearch-for-two-correlated-queries/m-p/380146#M111287</guid>
      <dc:creator>princeali</dc:creator>
      <dc:date>2018-11-08T21:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a subsearch for two correlated queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-subsearch-for-two-correlated-queries/m-p/380147#M111288</link>
      <description>&lt;P&gt;Hi princeali,&lt;BR /&gt;
let me know:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;do you have events in Index1 from server 1-server4 and events in index2 from server 1-server3 ?&lt;/LI&gt;
&lt;LI&gt;do you want to search events in index1 where server 1-server4 come from another search and to search events in index2 where server 1-server3 come from another different search?&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;In first case it's easy:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=index1 host=server 1 OR host=server2 OR host=server3 OR host=server4) OR (index=index2 host=server 1 OR host=server2 OR host=server3)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the second case:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=index1 [ search another_search1 host=server 1 OR host=server2 OR host=server3 OR host=server4 | dedup host | fields host]) OR (index=index2 [ search another_search2 host=server 1 OR host=server2 OR host=server3 | dedup host | fields host])
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You have to use the second one if you want to search in index1 and index2 only the hosts that you find in another search, if you want to search hosts in the same index you don't need a subsearch and you can use the first.&lt;/P&gt;

&lt;P&gt;In addition, remember that there's a limit of 50,000 to subsearch results.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 08:30:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-subsearch-for-two-correlated-queries/m-p/380147#M111288</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2018-11-09T08:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a subsearch for two correlated queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-subsearch-for-two-correlated-queries/m-p/380148#M111289</link>
      <description>&lt;P&gt;hi @princeali &lt;/P&gt;

&lt;P&gt;Did the answer below solve your problem? If so, please resolve this post by approving it! If your problem is still not solved, keep us updated so that someone else can help ya. Thanks for posting!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 20:32:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-create-a-subsearch-for-two-correlated-queries/m-p/380148#M111289</guid>
      <dc:creator>mstjohn_splunk</dc:creator>
      <dc:date>2018-11-12T20:32:15Z</dc:date>
    </item>
  </channel>
</rss>

