<?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: Subsearch Passback in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-Passback/m-p/183793#M52906</link>
    <description>&lt;P&gt;Does Map also have the same timeout as a subsearch? If not, is there a way to do this via the map command?&lt;/P&gt;</description>
    <pubDate>Fri, 15 Aug 2014 15:32:39 GMT</pubDate>
    <dc:creator>steven10172</dc:creator>
    <dc:date>2014-08-15T15:32:39Z</dc:date>
    <item>
      <title>Subsearch Passback</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-Passback/m-p/183791#M52904</link>
      <description>&lt;P&gt;I have the following sub-search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=voice "ani" "8005558508"
| rex field=_raw "{\"ani\",\"(?&amp;lt;ani&amp;gt;\d*)\"}"
| rex field=_raw "{\"vdu_id\",\"(?&amp;lt;vdu&amp;gt;.*?)\"}"
| where ani="8005558508" | fields vdu | table vdu | sort _time | head 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I would like to them port the results of &lt;CODE&gt;vdu&lt;/CODE&gt; into another search. The issue I'm having is that I only need the value of &lt;CODE&gt;vdu&lt;/CODE&gt; and not the key pair. If the above search returns &lt;CODE&gt;53ed0055005700000a54907d232e0002&lt;/CODE&gt; I need to then pass that into a search of this nature:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=voice "53ed0055005700000a54907d232e0002"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What's the best way to go about this?&lt;/P&gt;

&lt;P&gt;I tried using Map and the following, but neither seemed to work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=voice [search index=voice "ani" "8005558508"
| rex field=_raw "{\"ani\",\"(?&amp;lt;ani&amp;gt;\d*)\"}"
| rex field=_raw "{\"vdu_id\",\"(?&amp;lt;vdu&amp;gt;.*?)\"}"
| where ani="8005558508" | fields vdu | table vdu | sort _time | head 1]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Aug 2014 15:10:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-Passback/m-p/183791#M52904</guid>
      <dc:creator>steven10172</dc:creator>
      <dc:date>2014-08-15T15:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch Passback</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-Passback/m-p/183792#M52905</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=voice [search index=voice "ani" "8005558508"
| rex field=_raw "{\"ani\",\"(?&amp;lt;ani&amp;gt;\d*)\"}"
| where ani="8005558508"
| rex field=_raw "{\"vdu_id\",\"(?&amp;lt;vdu&amp;gt;.*?)\"}"
| table vdu | sort _time | head 1| eval search=vdu | return search]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Update:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Same method with little performance enhancement&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=voice [search index=voice  "{\"ani\",\"8005558508\"}"   
    | rex field=_raw "{\"vdu_id\",\"(?&amp;lt;vdu&amp;gt;.*?)\"}"
    | stats first(vdu) as search | return search]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Alternative with map&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=voice  "{\"ani\",\"8005558508\"}"   
        | rex field=_raw "{\"vdu_id\",\"(?&amp;lt;vdu&amp;gt;.*?)\"}"
        | stats first(vdu) as vdu | map maxsearches=1 search="search index=voice \"$vdu$\""
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR (with original search)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=voice "ani" "8005558508"
    | rex field=_raw "{\"ani\",\"(?&amp;lt;ani&amp;gt;\d*)\"}"
    | where ani="8005558508"
    | rex field=_raw "{\"vdu_id\",\"(?&amp;lt;vdu&amp;gt;.*?)\"}"
    | table vdu | sort _time | head 1 | map maxsearches=1 search="search index=voice \"$vdu$\""
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Aug 2014 15:15:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-Passback/m-p/183792#M52905</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-08-15T15:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch Passback</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-Passback/m-p/183793#M52906</link>
      <description>&lt;P&gt;Does Map also have the same timeout as a subsearch? If not, is there a way to do this via the map command?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Aug 2014 15:32:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-Passback/m-p/183793#M52906</guid>
      <dc:creator>steven10172</dc:creator>
      <dc:date>2014-08-15T15:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch Passback</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-Passback/m-p/183794#M52907</link>
      <description>&lt;P&gt;I think it doesn't have the same timeout. Try the updated answers.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Aug 2014 15:43:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-Passback/m-p/183794#M52907</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-08-15T15:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch Passback</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-Passback/m-p/183795#M52908</link>
      <description>&lt;P&gt;For the alternate with map I get the following error:  Unable to run query 'index=voice "53eddd6b000000000ac3b89223310002"'.&lt;/P&gt;

&lt;P&gt;But if I manually run that query everything runs fine&lt;/P&gt;</description>
      <pubDate>Fri, 15 Aug 2014 15:51:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-Passback/m-p/183795#M52908</guid>
      <dc:creator>steven10172</dc:creator>
      <dc:date>2014-08-15T15:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch Passback</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-Passback/m-p/183796#M52909</link>
      <description>&lt;P&gt;I was missing 'search' keyword there. Try the updated answer now.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Aug 2014 17:09:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-Passback/m-p/183796#M52909</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-08-15T17:09:35Z</dc:date>
    </item>
  </channel>
</rss>

