<?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: Pass arguments between two searches, different sources in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146393#M185224</link>
    <description>&lt;P&gt;Sorry for the delay. &lt;BR /&gt;
Yes, both searches have "token" extracted.&lt;BR /&gt;
I can manually perform search1- copy/paste "token" in search2, but I'd like to automate.&lt;/P&gt;</description>
    <pubDate>Sun, 07 Dec 2014 11:12:30 GMT</pubDate>
    <dc:creator>atanasmitev</dc:creator>
    <dc:date>2014-12-07T11:12:30Z</dc:date>
    <item>
      <title>Pass arguments between two searches, different sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146389#M185220</link>
      <description>&lt;P&gt;I am trying to perform a "for loop" splunk style, with two sources: source1 , source2. The searches right now looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1. source="source1" param1=value1 param2=value2 | stats values(token). I need the token for the next :

2. source="source2" param4="*" token
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried ( but returns error: "Error in 'map': Did not find value for required attribute 'token":&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="source1" param1=value1 param2=value2 | stats values(token) | 
map maxsearches=10 search="search source="source2" param4="*"  token=$token$ | 
stats values(param4) by token "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where am I wrong, and is there a way to optimize this ?&lt;BR /&gt;
I tried source1 OR source2, but then I need multiple OR ( AND ( OR))) clauses to match multiple needed parameters.&lt;/P&gt;

&lt;P&gt;Thanks in advance,&lt;/P&gt;</description>
      <pubDate>Sat, 06 Dec 2014 11:31:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146389#M185220</guid>
      <dc:creator>atanasmitev</dc:creator>
      <dc:date>2014-12-06T11:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments between two searches, different sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146390#M185221</link>
      <description>&lt;P&gt;You're basically trying to use results from one search to filter the next? No problem with subsearches:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="source2" param4="*" [search source="source1" param1=value1 param2=value2 | fields token | dedup token]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Open the job inspector to see the expression being returned by the subsearch, it'll be a huge ((OR))-behemoth.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Dec 2014 13:40:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146390#M185221</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-12-06T13:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments between two searches, different sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146391#M185222</link>
      <description>&lt;P&gt;True, but your way doesn't seem to be working.&lt;/P&gt;

&lt;P&gt;The way I tried to do it , search 1 would return a list or single token like so:&lt;/P&gt;

&lt;P&gt;tok_en1&lt;BR /&gt;
tok_en2&lt;/P&gt;

&lt;P&gt;What search 2 does is, foreach tok_en* get logged error message. It seems I need more time&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:20:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146391#M185222</guid>
      <dc:creator>atanasmitev</dc:creator>
      <dc:date>2020-09-28T18:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments between two searches, different sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146392#M185223</link>
      <description>&lt;P&gt;Do both sources have an extracted field &lt;CODE&gt;token&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Sat, 06 Dec 2014 16:04:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146392#M185223</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-12-06T16:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments between two searches, different sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146393#M185224</link>
      <description>&lt;P&gt;Sorry for the delay. &lt;BR /&gt;
Yes, both searches have "token" extracted.&lt;BR /&gt;
I can manually perform search1- copy/paste "token" in search2, but I'd like to automate.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Dec 2014 11:12:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146393#M185224</guid>
      <dc:creator>atanasmitev</dc:creator>
      <dc:date>2014-12-07T11:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments between two searches, different sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146394#M185225</link>
      <description>&lt;P&gt;That's exactly what the search-subsearch combo in my answer does.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Dec 2014 11:37:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146394#M185225</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-12-07T11:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments between two searches, different sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146395#M185226</link>
      <description>&lt;P&gt;The " [ inner search ] " returns the token alright , however it seems that the outer one doesn't understand the token provided ... I accepted your answer, as it seems the problem is related to my splunk instance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Dec 2014 12:49:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146395#M185226</guid>
      <dc:creator>atanasmitev</dc:creator>
      <dc:date>2014-12-07T12:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments between two searches, different sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146396#M185227</link>
      <description>&lt;P&gt;Do post the exact search you're running and the debug info shown at the top of the job inspector.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Dec 2014 14:02:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146396#M185227</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-12-07T14:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments between two searches, different sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146397#M185228</link>
      <description>&lt;P&gt;The working solution looks like this (note, results may vary, depending on what fields you have extracted) :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=common_index  source=source2 param5 param4="*"  
[ 
  search index=common_index source=source1 param1=value1 param2=value2  
|stats values(token) as omg 
|rename omg as query 
] 
| stats values(param4) by token
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This thing returns results like so :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;param4_value1  token1
param4_value2  token2
param4_value2  token3

etc. 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;martin_mueller, thanks one more time for helping &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2014 00:32:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-arguments-between-two-searches-different-sources/m-p/146397#M185228</guid>
      <dc:creator>atanasmitev</dc:creator>
      <dc:date>2014-12-19T00:32:31Z</dc:date>
    </item>
  </channel>
</rss>

