<?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 do we invoke a sub search with parameters from the parent search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484315#M135565</link>
    <description>&lt;P&gt;It should be in the search log.&lt;/P&gt;</description>
    <pubDate>Fri, 20 Sep 2019 17:16:21 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2019-09-20T17:16:21Z</dc:date>
    <item>
      <title>How do we invoke a sub search with parameters from the parent search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484310#M135560</link>
      <description>&lt;P&gt;We have a parent search that looks like - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os_linux * 
| eval length = len(process) 
| where length = 7 
| search process!= &amp;lt;conditions&amp;gt;
| dedup process dest 
| table process dest cmd_syslog2 _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Instead of the table we would like to issue a sub search and pass in the dest and process as parameters.&lt;/P&gt;

&lt;P&gt;The sub-search is -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os_linux 
| eval length = len(process) 
| where length = 7 
| search dest=&amp;lt;dest&amp;gt; process=&amp;lt;proces&amp;gt; 
| dedup _raw 
| table process dest _time cmd_syslog2 _raw 
| sort +_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope it makes sense ... &lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 19:31:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484310#M135560</guid>
      <dc:creator>danielbb</dc:creator>
      <dc:date>2019-09-19T19:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do we invoke a sub search with parameters from the parent search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484311#M135561</link>
      <description>&lt;P&gt;I think we have a terminology problem.  A "subsearch" is a search within a search.  Subsearches always execute first so it's not possible to pass anything from the parent to a subsearch.  You can, however, pass data from subsearch to parent.  Let's turn your query around and see if it does what you want.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os_linux 
  [ search index=os_linux | eval length = len(process) | where length = 7 | fields dest, process | format ]
| dedup _raw
| sort + _time
| table process dest _time cmd_syslog2 _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The subsearch returns a string like &lt;CODE&gt;((dest=foo process=barbarb) OR (dest=abc process=xyzzyzx))&lt;/CODE&gt;, which is then processed in the parent search and should produce the desired results.&lt;/P&gt;

&lt;P&gt;I'm not entirely certain the subsearch is needed.  Have you tried the simple version of the search?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os_linux 
| eval length = len(process) 
| where length = 7 
| dedup _raw 
| sort + _time
| table process dest _time cmd_syslog2 _raw 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Sep 2019 19:58:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484311#M135561</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-09-19T19:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do we invoke a sub search with parameters from the parent search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484312#M135562</link>
      <description>&lt;P&gt;@richgalloway, it seems the subsearch hits some limitations. If that's the case, where would they be reported? I don't see them via the Inspect Job... &lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 15:42:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484312#M135562</guid>
      <dc:creator>danielbb</dc:creator>
      <dc:date>2019-09-20T15:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do we invoke a sub search with parameters from the parent search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484313#M135563</link>
      <description>&lt;P&gt;Yes, subsearches are limited to 50,000 events.  There are settings in limits.conf to change them, but usually it's better to refine the search.  You can try &lt;CODE&gt;dedup&lt;/CODE&gt; to reduce the number of events returned from the subsearch.&lt;BR /&gt;
Have you tried the second search I offered?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 16:32:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484313#M135563</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-09-20T16:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do we invoke a sub search with parameters from the parent search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484314#M135564</link>
      <description>&lt;P&gt;Great, but if we hit the limit, where is it being reported? &lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 16:37:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484314#M135564</guid>
      <dc:creator>danielbb</dc:creator>
      <dc:date>2019-09-20T16:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do we invoke a sub search with parameters from the parent search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484315#M135565</link>
      <description>&lt;P&gt;It should be in the search log.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 17:16:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484315#M135565</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-09-20T17:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do we invoke a sub search with parameters from the parent search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484316#M135566</link>
      <description>&lt;P&gt;Hi @richgalloway,&lt;/P&gt;

&lt;P&gt;The following works for us - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os_linux 
   [ search index=os_linux | eval length = len(process) | where length = 7 | fields dest, process | rename dest as search |  format ]
 | dedup _raw
 | sort + _time
 | table process dest _time cmd_syslog2 _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;By adding &lt;CODE&gt;| rename dest as search&lt;/CODE&gt; the generated sub-search is in pairs of process and dest, otherwise it generated only the process  field, which is causing more results. &lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 20:21:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-invoke-a-sub-search-with-parameters-from-the-parent/m-p/484316#M135566</guid>
      <dc:creator>danielbb</dc:creator>
      <dc:date>2019-09-23T20:21:16Z</dc:date>
    </item>
  </channel>
</rss>

