<?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 find the matches of the fields from the first table with the values of the second in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-matches-of-the-fields-from-the-first-table-with/m-p/479081#M134305</link>
    <description>&lt;P&gt;What does your base search and append look like? Ideally you would not be appending anything. It should look something like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;(index=Table1 OR index=Table2)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;It sounds like you may come from a SQL background like myself. In Splunk, you don't want to join/intersect/append/sub search. It is always preferred to make the base search as broad (yet still small) as possible and then only to further refine the results from there. Don't even think of two separate queries as different tables. Think of them as different subsets of a single parent search.&lt;/P&gt;</description>
    <pubDate>Wed, 11 Sep 2019 16:25:03 GMT</pubDate>
    <dc:creator>jacobpevans</dc:creator>
    <dc:date>2019-09-11T16:25:03Z</dc:date>
    <item>
      <title>How to find the matches of the fields from the first table with the values of the second</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-matches-of-the-fields-from-the-first-table-with/m-p/479078#M134302</link>
      <description>&lt;P&gt;Hello.&lt;BR /&gt;
I have two tables. &lt;BR /&gt;
I need to compare the values of two columns in each table.&lt;BR /&gt;
In result, I want to receive rows from the first table only with fields, which faced in the second table.&lt;/P&gt;

&lt;P&gt;Table 1&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;  v11   v12   v13   v14&lt;/LI&gt;
&lt;LI&gt;  &lt;STRONG&gt;v21&lt;/STRONG&gt;   &lt;STRONG&gt;v22&lt;/STRONG&gt;   v23   v24&lt;/LI&gt;
&lt;LI&gt;  &lt;STRONG&gt;v31&lt;/STRONG&gt;   &lt;STRONG&gt;v32&lt;/STRONG&gt;   v33   v34&lt;/LI&gt;
&lt;LI&gt;  v41   v42   v43   v44&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Table 2&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;  v21   v22 &lt;/LI&gt;
&lt;LI&gt;  v31   v32 &lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;As a result, I need to receive only two strings №2 and №3 from the first table.&lt;/P&gt;

&lt;P&gt;I can't use subsearch because in the second table more than 2 million strings... And I need to start this search every minute.&lt;/P&gt;

&lt;P&gt;Have you any ideas? &lt;BR /&gt;
Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 13:48:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-matches-of-the-fields-from-the-first-table-with/m-p/479078#M134302</guid>
      <dc:creator>verteletskyia</dc:creator>
      <dc:date>2019-09-10T13:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the matches of the fields from the first table with the values of the second</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-matches-of-the-fields-from-the-first-table-with/m-p/479079#M134303</link>
      <description>&lt;P&gt;Greetings @verteletskyia,&lt;/P&gt;

&lt;P&gt;Assuming there are no duplicates in Table 1, you could do something like this run-anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;           | makeresults | eval col1="v11", col2="v12", col3="v13", col4="v14"
| append [ | makeresults | eval col1="v21", col2="v22", col3="v23", col4="v24" ]
| append [ | makeresults | eval col1="v31", col2="v32", col3="v33", col4="v34" ]
| append [ | makeresults | eval col1="v41", col2="v42", col3="v43", col4="v44" ]
| append [ | makeresults | eval col1="v21", col2="v22" ]
| append [ | makeresults | eval col1="v31", col2="v32" ]

| stats values(col3) as col3
        values(col4) as col4
        count
    by col1 col2
| where count &amp;gt; 1
| mvexpand col3
| mvexpand col4
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Sep 2019 21:53:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-matches-of-the-fields-from-the-first-table-with/m-p/479079#M134303</guid>
      <dc:creator>jacobpevans</dc:creator>
      <dc:date>2019-09-10T21:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the matches of the fields from the first table with the values of the second</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-matches-of-the-fields-from-the-first-table-with/m-p/479080#M134304</link>
      <description>&lt;P&gt;Rockin' cool, @jacobevans! Thanks for the answer.&lt;/P&gt;

&lt;P&gt;But when we adapted it for our data, we faced the new issue: the long-time request, where appending &amp;gt;2M events from the &lt;STRONG&gt;table 2&lt;/STRONG&gt; is taking most of the time.&lt;BR /&gt;
Is any decision (may be architectural) for this one?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2019 12:30:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-matches-of-the-fields-from-the-first-table-with/m-p/479080#M134304</guid>
      <dc:creator>i_vern</dc:creator>
      <dc:date>2019-09-11T12:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the matches of the fields from the first table with the values of the second</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-matches-of-the-fields-from-the-first-table-with/m-p/479081#M134305</link>
      <description>&lt;P&gt;What does your base search and append look like? Ideally you would not be appending anything. It should look something like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;(index=Table1 OR index=Table2)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;It sounds like you may come from a SQL background like myself. In Splunk, you don't want to join/intersect/append/sub search. It is always preferred to make the base search as broad (yet still small) as possible and then only to further refine the results from there. Don't even think of two separate queries as different tables. Think of them as different subsets of a single parent search.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2019 16:25:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-matches-of-the-fields-from-the-first-table-with/m-p/479081#M134305</guid>
      <dc:creator>jacobpevans</dc:creator>
      <dc:date>2019-09-11T16:25:03Z</dc:date>
    </item>
  </channel>
</rss>

