<?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: Find Events in one index based on a result set in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Find-Events-in-one-index-based-on-a-result-set/m-p/574484#M200206</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;quite often you should avoid join to join datasets. Here is excellent presentation why&amp;nbsp;&lt;A href="https://conf.splunk.com/files/2020/slides/TRU1761C.pdf" target="_blank"&gt;https://conf.splunk.com/files/2020/slides/TRU1761C.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;There are some other presentations too which are worth of look.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
    <pubDate>Wed, 10 Nov 2021 19:45:13 GMT</pubDate>
    <dc:creator>isoutamo</dc:creator>
    <dc:date>2021-11-10T19:45:13Z</dc:date>
    <item>
      <title>Find Events in one index based on a result set</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-Events-in-one-index-based-on-a-result-set/m-p/574465#M200194</link>
      <description>&lt;P&gt;I want to find items in one index based on results from another index's search. I have the following but only get a handful of results for some reason.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=a sourcetype=test
|join id [search index b | rename id as idb]
|stats count by id, idb&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this the best way to accomplish it and any reason I only get a small number of results?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 17:54:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-Events-in-one-index-based-on-a-result-set/m-p/574465#M200194</guid>
      <dc:creator>SMM10</dc:creator>
      <dc:date>2021-11-10T17:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Find Events in one index based on a result set</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-Events-in-one-index-based-on-a-result-set/m-p/574477#M200200</link>
      <description>&lt;P&gt;The join command works much like it would in SQL.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If Index A has the field idb, it will display the events where idb matches found in both Index A and B.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The query as you stated will only provide events where the value is found in both Indexes.&lt;/P&gt;&lt;P&gt;If you wanted all events from A and any events from B that match on idb you can add the type:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=a sourcetype=test
|join type=left id [search index b | rename id as idb]
|stats count by id, idb&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 18:52:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-Events-in-one-index-based-on-a-result-set/m-p/574477#M200200</guid>
      <dc:creator>jcraumer</dc:creator>
      <dc:date>2021-11-10T18:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Find Events in one index based on a result set</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-Events-in-one-index-based-on-a-result-set/m-p/574484#M200206</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;quite often you should avoid join to join datasets. Here is excellent presentation why&amp;nbsp;&lt;A href="https://conf.splunk.com/files/2020/slides/TRU1761C.pdf" target="_blank"&gt;https://conf.splunk.com/files/2020/slides/TRU1761C.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;There are some other presentations too which are worth of look.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 19:45:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-Events-in-one-index-based-on-a-result-set/m-p/574484#M200206</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-11-10T19:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Find Events in one index based on a result set</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-Events-in-one-index-based-on-a-result-set/m-p/574485#M200207</link>
      <description>&lt;P&gt;Join is one way to do it, but can be inefficient.&amp;nbsp; If you use &lt;FONT face="courier new,courier"&gt;join&lt;/FONT&gt;, understand that Splunk will match events based only on the specified field name(s) (or all common fields if none are specified).&lt;/P&gt;&lt;P&gt;Another way to combine results is using &lt;FONT face="courier new,courier"&gt;append&lt;/FONT&gt;.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=a sourcetype=test
| append [search index b | rename id as idb]
|stats count by id, idb&lt;/LI-CODE&gt;&lt;P&gt;Yet another way, and probably the best way if I understand the use case correctly, is to use a subsearch.&amp;nbsp; A subsearch runs before the main search and its results become part of the main search.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=a sourcetype=test [search index b | fields id | format ]
|stats count by id&lt;/LI-CODE&gt;&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;format&lt;/FONT&gt; command converts the subsearch results into a boolean expression the main search can evaluate.&amp;nbsp; It's important for the subsearch to return field names that exist in the main search otherwise it may fail to find the right results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 19:48:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-Events-in-one-index-based-on-a-result-set/m-p/574485#M200207</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-11-10T19:48:42Z</dc:date>
    </item>
  </channel>
</rss>

