<?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 query using values that come from the result of a different query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-query-using-values-that-come-from-the-result-of/m-p/193384#M55646</link>
    <description>&lt;P&gt;Assuming you have the field RequestID extracted for both Request and Response XML data, try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search to get request xml  [search your base search to get Response xml | table RequestID ] | rest of the search
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;THe subsearch will get list of RequestID and make a giant OR condition , which will filter the data from  your base search which is for Requests.&lt;BR /&gt;
&lt;STRONG&gt;&lt;EM&gt;Update&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search to get Response XML | rex field=_raw "requestID\&amp;gt;(?&amp;lt;RequestId&amp;gt;[^\&amp;lt;])" |  eval search="requestID\&amp;gt;".RequestId | table search] | rest of the search
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 25 Aug 2015 22:45:42 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2015-08-25T22:45:42Z</dc:date>
    <item>
      <title>How to create a query using values that come from the result of a different query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-query-using-values-that-come-from-the-result-of/m-p/193383#M55645</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;So I'm logging xml requests and responses as raw strings into splunk. To get the responses searching, among other things, the following string:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;gt;response&amp;lt;/
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This results of this will have a value that will help me link them to the request associated to that response. My question is, how can I search for the requests associated to those specific results.&lt;/P&gt;

&lt;P&gt;So for example, my first query returns 100 responses with different unique "RequestID", how do i find the 100 requests that have that "RequestID".&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2015 20:58:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-query-using-values-that-come-from-the-result-of/m-p/193383#M55645</guid>
      <dc:creator>HomelessMonkey</dc:creator>
      <dc:date>2015-08-25T20:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a query using values that come from the result of a different query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-query-using-values-that-come-from-the-result-of/m-p/193384#M55646</link>
      <description>&lt;P&gt;Assuming you have the field RequestID extracted for both Request and Response XML data, try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search to get request xml  [search your base search to get Response xml | table RequestID ] | rest of the search
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;THe subsearch will get list of RequestID and make a giant OR condition , which will filter the data from  your base search which is for Requests.&lt;BR /&gt;
&lt;STRONG&gt;&lt;EM&gt;Update&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search to get Response XML | rex field=_raw "requestID\&amp;gt;(?&amp;lt;RequestId&amp;gt;[^\&amp;lt;])" |  eval search="requestID\&amp;gt;".RequestId | table search] | rest of the search
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Aug 2015 22:45:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-query-using-values-that-come-from-the-result-of/m-p/193384#M55646</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-08-25T22:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a query using values that come from the result of a different query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-query-using-values-that-come-from-the-result-of/m-p/193385#M55647</link>
      <description>&lt;P&gt;Sadly the whole thing is just a raw string so it's more like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[rest of the xml]&amp;lt;requestId&amp;gt;value&amp;lt;/requestid&amp;gt;..[rest of the xml]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Aug 2015 23:22:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-query-using-values-that-come-from-the-result-of/m-p/193385#M55647</guid>
      <dc:creator>HomelessMonkey</dc:creator>
      <dc:date>2015-08-25T23:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a query using values that come from the result of a different query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-query-using-values-that-come-from-the-result-of/m-p/193386#M55648</link>
      <description>&lt;P&gt;I just tried your Updated code as suggested and I'm getting parser errors. Trying to look up in the documentation, just to be sure my query is looking something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;responseQuery | rex field=_raw "requestID\&amp;gt;(?&amp;lt;RequestId&amp;gt;[^\&amp;lt;])" |  eval search="requestID\&amp;gt;".RequestId | table search] | requestQuery
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Getting a "mismatched ]" error (guessing it is the one after search. When removing it, it tries to parse the query as a command. Thanks so much for the help so far, I'm not used to performing this kind of queries.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2015 19:45:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-query-using-values-that-come-from-the-result-of/m-p/193386#M55648</guid>
      <dc:creator>HomelessMonkey</dc:creator>
      <dc:date>2015-08-26T19:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a query using values that come from the result of a different query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-query-using-values-that-come-from-the-result-of/m-p/193387#M55649</link>
      <description>&lt;P&gt;If you can post sample query using which you're getting response data and request data (two separate queries), I can help you translate this correctly.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2015 19:56:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-query-using-values-that-come-from-the-result-of/m-p/193387#M55649</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-08-26T19:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a query using values that come from the result of a different query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-query-using-values-that-come-from-the-result-of/m-p/193388#M55650</link>
      <description>&lt;P&gt;Request: [environment name] "&amp;gt;request&amp;lt;/" ProcessXmlStream&lt;BR /&gt;
Response: "&amp;gt;response&amp;lt;/"  [Error code]&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2015 22:22:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-query-using-values-that-come-from-the-result-of/m-p/193388#M55650</guid>
      <dc:creator>HomelessMonkey</dc:creator>
      <dc:date>2015-08-26T22:22:53Z</dc:date>
    </item>
  </channel>
</rss>

