<?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: send parameter to eval with return search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/send-parameter-to-eval-with-return-search/m-p/113126#M29715</link>
    <description>&lt;P&gt;Not the way you are doing it. You can return data from a subsearch, either as a single value, a field-value pair, or set of field-value pairs. That't not the problem.&lt;/P&gt;

&lt;P&gt;What you &lt;EM&gt;can't&lt;/EM&gt; do is to pass data from the main search to the subsearch. &lt;CODE&gt;where field_SUB=field_MAIN&lt;/CODE&gt; is not legal. Splunk executes the subsearch &lt;STRONG&gt;first&lt;/STRONG&gt;, so there is no data from the main search to pass.&lt;/P&gt;

&lt;P&gt;If you want to combine data from two searches in that way, you will need to use another technique. For the example you have given, it appears that you are trying to lookup a value for fieldA from index=other_index. For that, I would use a lookup instead of a second index.&lt;/P&gt;

&lt;P&gt;More information about what you are trying to do would probably be helpful.&lt;/P&gt;</description>
    <pubDate>Sun, 07 Sep 2014 02:19:37 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2014-09-07T02:19:37Z</dc:date>
    <item>
      <title>send parameter to eval with return search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/send-parameter-to-eval-with-return-search/m-p/113125#M29714</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
You can send a parameter from the main search to return search? &lt;BR /&gt;
I need to put a condition to return value, something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main field_MAIN=* 
| eval test=if(isNull(fieldA),[search index=other_index field_SUB=* | where field_SUB=field_MAIN | head 1 | return $fieldA],fieldA)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note the &lt;CODE&gt;where field_SUB=field_MAIN&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;is it possible? &lt;BR /&gt;
Or some other way to get it?&lt;BR /&gt;
Thanks!!&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2014 14:39:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/send-parameter-to-eval-with-return-search/m-p/113125#M29714</guid>
      <dc:creator>jrodriguezap</dc:creator>
      <dc:date>2014-09-05T14:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: send parameter to eval with return search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/send-parameter-to-eval-with-return-search/m-p/113126#M29715</link>
      <description>&lt;P&gt;Not the way you are doing it. You can return data from a subsearch, either as a single value, a field-value pair, or set of field-value pairs. That't not the problem.&lt;/P&gt;

&lt;P&gt;What you &lt;EM&gt;can't&lt;/EM&gt; do is to pass data from the main search to the subsearch. &lt;CODE&gt;where field_SUB=field_MAIN&lt;/CODE&gt; is not legal. Splunk executes the subsearch &lt;STRONG&gt;first&lt;/STRONG&gt;, so there is no data from the main search to pass.&lt;/P&gt;

&lt;P&gt;If you want to combine data from two searches in that way, you will need to use another technique. For the example you have given, it appears that you are trying to lookup a value for fieldA from index=other_index. For that, I would use a lookup instead of a second index.&lt;/P&gt;

&lt;P&gt;More information about what you are trying to do would probably be helpful.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Sep 2014 02:19:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/send-parameter-to-eval-with-return-search/m-p/113126#M29715</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-09-07T02:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: send parameter to eval with return search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/send-parameter-to-eval-with-return-search/m-p/113127#M29716</link>
      <description>&lt;P&gt;Hello Iguiin &lt;BR /&gt;
Thanks, look, I have logs like these:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  session_id             src_email                dst_email
f2-5407ee2265d2 alexcolquehuanca@hotmail.com   jperez@unicon.com
f2-54asds326sf3 asistecnica@assesores.com      jose.tejadaz@unicon.com
f2-54ds345asf32                                secretary@unicon.com
f2-5407easass22 josevasquez@gmail.com          jose.tejadaz@unicon.com
f2-54ds345asf32 alemontorya@verifica.com
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You see, there are some who lack the src_email field, then I try to fill it doing that search return, associating with the session_id field. &lt;BR /&gt;
I tried to "transaction" masspan = 1d, but in reality, the waiting time to run is very high&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=172.16.1.21 | eval dst_email=if(isNull(src_email),[search host=172.16.1.21 src_email=* earliest=-1d latest=now | where session_id=session_idMAIN | head 1| return $src_email],src_email)
| table session_id,src_email,dst_email
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:30:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/send-parameter-to-eval-with-return-search/m-p/113127#M29716</guid>
      <dc:creator>jrodriguezap</dc:creator>
      <dc:date>2020-09-28T17:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: send parameter to eval with return search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/send-parameter-to-eval-with-return-search/m-p/113128#M29717</link>
      <description>&lt;P&gt;Hello&lt;BR /&gt;
You think that is possible? or is there any other way?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Sep 2014 16:45:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/send-parameter-to-eval-with-return-search/m-p/113128#M29717</guid>
      <dc:creator>jrodriguezap</dc:creator>
      <dc:date>2014-09-08T16:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: send parameter to eval with return search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/send-parameter-to-eval-with-return-search/m-p/113129#M29718</link>
      <description>&lt;P&gt;This will work for the example you have given - and be much faster&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=172.16.1.21 
| stats values(src_email) as src_email values(dst_email) as dst_email by session_id
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Sep 2014 23:26:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/send-parameter-to-eval-with-return-search/m-p/113129#M29718</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-09-08T23:26:46Z</dc:date>
    </item>
  </channel>
</rss>

