<?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 create a single search where the output of the first query should act as input to the second query. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-create-a-single-search-where-the-output-of-the-first/m-p/289183#M161634</link>
    <description>&lt;P&gt;You need to use subsearch like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=B [search index=A | search PC="*" | table ReqID | rename reqID as RequestersID ] | table RequesterID index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Since you're looking for events which has same RequesterID as ReqID in index A, both fields in your final table ReqID and RequestersID will be same, so I've not added it. If you need it , just add &lt;CODE&gt;| eval ReqID =RequesterID&lt;/CODE&gt; at the end.&lt;/P&gt;</description>
    <pubDate>Mon, 27 Mar 2017 14:11:42 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-03-27T14:11:42Z</dc:date>
    <item>
      <title>how to create a single search where the output of the first query should act as input to the second query.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-create-a-single-search-where-the-output-of-the-first/m-p/289182#M161633</link>
      <description>&lt;P&gt;We have two indexers in place. index=A &amp;amp; index=B. From index=A I have queried out the field which I want the value for.&lt;BR /&gt;
index=A | search PC="*" | table ReqID index, this will return value to the field ReqID. Lets say ReqID=X.&lt;/P&gt;

&lt;P&gt;Now I have to use the value of the above field ReqID=X and search in another index=B. In the index=B the same value carries a field name called RequestersID=X.&lt;/P&gt;

&lt;P&gt;I have to create a search query in such way that output from the first index should automatically serve the purpose as input to the second index=B and provide a combine result in the form of table.&lt;BR /&gt;
| table ReqID RequestersID index&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2017 13:27:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-create-a-single-search-where-the-output-of-the-first/m-p/289182#M161633</guid>
      <dc:creator>dina1701</dc:creator>
      <dc:date>2017-03-27T13:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a single search where the output of the first query should act as input to the second query.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-create-a-single-search-where-the-output-of-the-first/m-p/289183#M161634</link>
      <description>&lt;P&gt;You need to use subsearch like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=B [search index=A | search PC="*" | table ReqID | rename reqID as RequestersID ] | table RequesterID index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Since you're looking for events which has same RequesterID as ReqID in index A, both fields in your final table ReqID and RequestersID will be same, so I've not added it. If you need it , just add &lt;CODE&gt;| eval ReqID =RequesterID&lt;/CODE&gt; at the end.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2017 14:11:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-create-a-single-search-where-the-output-of-the-first/m-p/289183#M161634</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-27T14:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a single search where the output of the first query should act as input to the second query.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-create-a-single-search-where-the-output-of-the-first/m-p/289184#M161635</link>
      <description>&lt;P&gt;Thanks somesoni2 for replying. Can you please anything further on this to obtain the results&lt;/P&gt;

&lt;P&gt;I have tried executing this command, I was quite unsuccessful as there no events getting written&lt;BR /&gt;
index=orsapps [ search index=esbapps | search E2E_busProcID="D1 7SH" | table ReqID | rename ReqID as RequestersID ] | rex "RequestersID&amp;gt;(?[^&amp;lt;]*)" | table RequestersID _time index&lt;/P&gt;

&lt;P&gt;But when I type individual queries I am able to see the table -&lt;BR /&gt;
index=orsapps&lt;BR /&gt;
| rex "RequestersID&amp;gt;(?[^&amp;lt;]*)"&lt;BR /&gt;
| table RequestersID _time index&lt;/P&gt;

&lt;P&gt;Result -&lt;BR /&gt;
RequestersID _time index&lt;BR /&gt;
0610479853358211 2017-03-27 11:28:00 orsapps&lt;BR /&gt;
0610479853358211 2017-03-27 11:28:00 orsapps&lt;BR /&gt;
0610479853358211 2017-03-27 11:28:00 orsapps&lt;BR /&gt;
0610479853358211 2017-03-27 11:28:00 orsapps&lt;BR /&gt;
0610467479012357 2017-03-27 11:27:48 orsapps&lt;BR /&gt;
0610467479012357 2017-03-27 11:27:48 orsapps&lt;BR /&gt;
0610467479012357 2017-03-27 11:27:48 orsapps&lt;BR /&gt;
0610467479012357 2017-03-27 11:27:48 orsapps&lt;/P&gt;

&lt;P&gt;Individual subquery result -&lt;BR /&gt;
search index=esbapps | search E2E_busProcID="D1 7SH" | table ReqID | rename ReqID as RequestersID&lt;/P&gt;

&lt;P&gt;RequestersID _time index&lt;BR /&gt;
0610479853358211 2017-03-27 11:29:06 esbapps&lt;BR /&gt;
2017-03-27 11:29:06 esbapps&lt;BR /&gt;
2017-03-27 11:29:06 esbapps&lt;BR /&gt;
0610479853358211 2017-03-27 11:29:05 esbapps&lt;BR /&gt;
0610467479012357 2017-03-27 11:28:55 esbapps&lt;BR /&gt;
2017-03-27 11:28:54 esbapps&lt;BR /&gt;
2017-03-27 11:28:54 esbapps&lt;BR /&gt;
0610467479012357 2017-03-27 11:28:53 esbapps&lt;/P&gt;

&lt;P&gt;Output of the first query is to be servered as the input to the first query. Can you please help me in getting all in a same table as in the final result. Final table format -&lt;BR /&gt;
RequestersID _time index&lt;BR /&gt;
xxxxx xxxxx esbapps&lt;BR /&gt;
xxxxx xxxxx orsapps&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 11:55:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-create-a-single-search-where-the-output-of-the-first/m-p/289184#M161635</guid>
      <dc:creator>dina1701</dc:creator>
      <dc:date>2017-03-29T11:55:01Z</dc:date>
    </item>
  </channel>
</rss>

