<?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 value to subsearch with inputlookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494992#M138008</link>
    <description>&lt;P&gt;number like 1 or 2 or ...&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jan 2020 11:59:37 GMT</pubDate>
    <dc:creator>tdoSplunk</dc:creator>
    <dc:date>2020-01-23T11:59:37Z</dc:date>
    <item>
      <title>Pass value to subsearch with inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494990#M138006</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;perhaps it is the wrong approach, but i try to use an inputlookup within a search and pass a value to this subsearch.&lt;BR /&gt;
It looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index=myindex sourcetype=stype source=sourcename
    |eval SourceHost =[|inputlookup transfer_nodes.csv 
                       |search nodeId IN ($last_source_node_id$)
                       |fields name
                       |stats first(name) as SourceHost
                       |eval SourceHost="\"".SourceHost."\""
                       |return $SourceHost
                      ]
|eval DestinationHost =[|inputlookup transfer_nodes.csv 
                       |search nodeId IN ($last_dest_node_id$)
                       |fields name
                       |stats first(name) as DestinationHost
                       |eval DestinationHost="\"".DestinationHost."\""
                       |return $DestinationHost
                      ]
    |table name,SourceHost,DestinationHost
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get the following error: Error in 'eval' command: Failed to parse the provided arguments. Usage: eval dest_key = expression.&lt;/P&gt;

&lt;P&gt;The problem is the passing of the value $last_source_node_id$ ($last_dest_node_id$)&lt;/P&gt;

&lt;P&gt;I already tried to map the subsearch, then the passing works, but the result is not what i expected.&lt;/P&gt;

&lt;P&gt;Finally I would like to use a macro like GetTransferNode($last_nodeId$)&lt;/P&gt;

&lt;P&gt;Hope you have an idea how to solve it. &lt;/P&gt;

&lt;P&gt;best regards and thank you in advance !&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:54:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494990#M138006</guid>
      <dc:creator>tdoSplunk</dc:creator>
      <dc:date>2020-09-30T03:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Pass value to subsearch with inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494991#M138007</link>
      <description>&lt;P&gt;What's token value "$last_source_node_id$"?&lt;BR /&gt;
like &lt;CODE&gt;A, B&lt;/CODE&gt; ?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:47:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494991#M138007</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-09-30T03:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Pass value to subsearch with inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494992#M138008</link>
      <description>&lt;P&gt;number like 1 or 2 or ...&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 11:59:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494992#M138008</guid>
      <dc:creator>tdoSplunk</dc:creator>
      <dc:date>2020-01-23T11:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Pass value to subsearch with inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494993#M138009</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;    index=myindex sourcetype=stype source=sourcename
     |eval SourceHost =[|inputlookup transfer_nodes.csv 
                        |search nodeId=$last_source_node_id$
                        |fields name
                        |stats first(name) as SourceHost
                        |eval SourceHost="\"".SourceHost."\""
                        |return $SourceHost
                       ]
 |eval DestinationHost =[|inputlookup transfer_nodes.csv 
                        |search nodeId=$last_dest_node_id$
                        |fields name
                        |stats first(name) as DestinationHost
                        |eval DestinationHost="\"".DestinationHost."\""
                        |return $DestinationHost
                       ]
     |table name,SourceHost,DestinationHost
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;unnecessary &lt;CODE&gt;IN&lt;/CODE&gt; operator. How about this?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 12:06:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494993#M138009</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-23T12:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Pass value to subsearch with inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494994#M138010</link>
      <description>&lt;P&gt;this will not work. it is not possible to pass the token $last_dest_node_id$ to the subsearch&lt;/P&gt;

&lt;P&gt;A map would be a possible solution like ...&lt;BR /&gt;
|map [|inputlookup transfer_nodes.csv &lt;BR /&gt;
            |search nodeId=$last_source_node_id$]&lt;/P&gt;

&lt;P&gt;but the table only contained the result of the subsearch, not the conbination of both searches&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:54:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494994#M138010</guid>
      <dc:creator>tdoSplunk</dc:creator>
      <dc:date>2020-09-30T03:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Pass value to subsearch with inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494995#M138011</link>
      <description>&lt;P&gt;I solved it by a join...&lt;BR /&gt;
First I thought it will be to slow, but it works fine&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| join type=left nodeId 
   [ |inputlookup transfer_nodes.csv
   |rename name as DestinationHost]
...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jan 2020 12:29:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494995#M138011</guid>
      <dc:creator>tdoSplunk</dc:creator>
      <dc:date>2020-01-23T12:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: Pass value to subsearch with inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494996#M138012</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype=stype source=sourcename
[|inputlookup append=t transfer_nodes.csv]
|search nodeId=$last_source_node_id$ OR nodeId=$last_dest_node_id$
| eval host_flag=case(node_id=$last_source_node_id$,"Source",node_id=$last_dest_node_id$,"Dest")
| stats values(eval(if(flag="Source",name,NULL))) as SourceHost values(eval(if(flag="Dest",name,NULL))) as DestHost by name 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think, your result is like the result of this.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 12:34:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-value-to-subsearch-with-inputlookup/m-p/494996#M138012</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-23T12:34:34Z</dc:date>
    </item>
  </channel>
</rss>

