<?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: using subsearches on different index in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearches-on-a-different-index/m-p/587617#M204637</link>
    <description>&lt;P&gt;Will something like this work?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype=INDEX_B index=INDEX_B
[search sourcetype=INDEX_B index=INDEX_B
[search sourcetype=INDEX_A to=*&amp;lt;email address&amp;gt;* | fields msgid |rename msgid as hdr_mid] | table qid]&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 04 Mar 2022 08:56:22 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2022-03-04T08:56:22Z</dc:date>
    <item>
      <title>How to use subsearches on a different index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearches-on-a-different-index/m-p/587610#M204634</link>
      <description>&lt;P&gt;I want to search all the email logs for a mail transaction.&amp;nbsp; However we have multiple indexes for our mail logs.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When i run the search below , it gets the qid&amp;nbsp; which is the expected behavior.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;sourcetype=INDEX_B index=INDEX_B
[search sourcetype=INDEX_A to=*&amp;lt;email address&amp;gt;* | fields msgid |rename msgid as hdr_mid] | table qid&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;msgid/hdr_mid = unique email id in index_A. I have to rename msgid to hdr_mid as thats the name of the field in INDEX_A
qid = another unique id in INDEX_B  that corresponds to INDEX_A&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What i want to accomplish is that the result of the qid will immediately search all match in INDEX_B but its not generating any search result. Below is the&amp;nbsp; modified version i made.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;sourcetype=INDEX_B index=INDEX_B
[search sourcetype=INDEX_B index=INDEX_B | search
[search sourcetype=INDEX_A to=*&amp;lt;email address&amp;gt;* | fields msgid |rename msgid as hdr_mid | rename qid as search]] | table qid&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 01:24:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearches-on-a-different-index/m-p/587610#M204634</guid>
      <dc:creator>chicocinco</dc:creator>
      <dc:date>2022-03-08T01:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: using subsearches on different index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearches-on-a-different-index/m-p/587617#M204637</link>
      <description>&lt;P&gt;Will something like this work?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype=INDEX_B index=INDEX_B
[search sourcetype=INDEX_B index=INDEX_B
[search sourcetype=INDEX_A to=*&amp;lt;email address&amp;gt;* | fields msgid |rename msgid as hdr_mid] | table qid]&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 04 Mar 2022 08:56:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearches-on-a-different-index/m-p/587617#M204637</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-03-04T08:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: using subsearches on different index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearches-on-a-different-index/m-p/587637#M204646</link>
      <description>&lt;P&gt;i tried your suggestions that is remove the second search and move one of the bracked to the last and it threw an error instead&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 11:39:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearches-on-a-different-index/m-p/587637#M204646</guid>
      <dc:creator>chicocinco</dc:creator>
      <dc:date>2022-03-04T11:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: using subsearches on different index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearches-on-a-different-index/m-p/587801#M204713</link>
      <description>&lt;P&gt;You get an error because you didn't substitute "&amp;lt;email address&amp;gt;" with a literal string as you originally intended. (You should get the same error if you run your original search with the angled brackets.)&lt;/P&gt;&lt;P&gt;Meanwhile, the original question is rather ambiguous. &amp;nbsp;If the qid values from the table command are the matching qid from the subsearch, the results from&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype=INDEX_B index=INDEX_B
[search sourcetype=INDEX_A to=*&amp;lt;email address&amp;gt;* | fields msgid |rename msgid as hdr_mid]]&lt;/LI-CODE&gt;&lt;P&gt;already contain everything matching these qid's. &amp;nbsp;What else is expected? (I take that the statement &amp;nbsp;"I have to rename msgid to hdr_mid as thats the name of the field in INDEX_A" should read as "I have to rename msgid to hdr_mid as thats the name of a matching field in INDEX_B.")&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 07:08:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-subsearches-on-a-different-index/m-p/587801#M204713</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-03-07T07:08:03Z</dc:date>
    </item>
  </channel>
</rss>

