<?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 How can I use a search result as a filename variable of a inputlookup  statement in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-a-search-result-as-a-filename-variable-of-a/m-p/441162#M125345</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I like to setup a kind of help-text library based on unique msgcode-xx.csv text files. (or internal/external tml pages/files)&lt;/P&gt;

&lt;P&gt;With the code beneath I try to look for a filename in  EVENTLIST_3v3 that I can use as an input for an appended inputlookup statement.  Lookup goes ok, but I can not get it passed further as a filename argument for the next inputlookup statement. &lt;BR /&gt;
Nb.  the filename is stored in the EVENTLIST_3v3 . &lt;/P&gt;

&lt;P&gt;What ever I tried nothing works sofar and I do not understand why a correct filename string can not be processed as parameter of a following (append,join etc) inputlookup command.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;What do I miss here? Has some one have a clue?&lt;/LI&gt;
&lt;LI&gt;Has some one have a better approach for this  help-library functions (ie linking to html pages?)&lt;BR /&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;| makeresults &lt;BR /&gt;
| eval msgtxt="46 - No intervention needed" , msgcode=substr(msgtxt,0,2) | table msgcode&lt;BR /&gt;
| lookup EVENTLIST_3v3 nr as msgcode OUTPUT  helpdoc&lt;BR /&gt;
| table helpdoc&lt;BR /&gt;
| appendcols&lt;BR /&gt;
    [|inputlookup helpdoc | table *]&lt;/P&gt;

&lt;P&gt;regards&lt;BR /&gt;
Ashley Pietersen&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 20:27:59 GMT</pubDate>
    <dc:creator>apietersen</dc:creator>
    <dc:date>2020-09-29T20:27:59Z</dc:date>
    <item>
      <title>How can I use a search result as a filename variable of a inputlookup  statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-a-search-result-as-a-filename-variable-of-a/m-p/441162#M125345</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I like to setup a kind of help-text library based on unique msgcode-xx.csv text files. (or internal/external tml pages/files)&lt;/P&gt;

&lt;P&gt;With the code beneath I try to look for a filename in  EVENTLIST_3v3 that I can use as an input for an appended inputlookup statement.  Lookup goes ok, but I can not get it passed further as a filename argument for the next inputlookup statement. &lt;BR /&gt;
Nb.  the filename is stored in the EVENTLIST_3v3 . &lt;/P&gt;

&lt;P&gt;What ever I tried nothing works sofar and I do not understand why a correct filename string can not be processed as parameter of a following (append,join etc) inputlookup command.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;What do I miss here? Has some one have a clue?&lt;/LI&gt;
&lt;LI&gt;Has some one have a better approach for this  help-library functions (ie linking to html pages?)&lt;BR /&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;| makeresults &lt;BR /&gt;
| eval msgtxt="46 - No intervention needed" , msgcode=substr(msgtxt,0,2) | table msgcode&lt;BR /&gt;
| lookup EVENTLIST_3v3 nr as msgcode OUTPUT  helpdoc&lt;BR /&gt;
| table helpdoc&lt;BR /&gt;
| appendcols&lt;BR /&gt;
    [|inputlookup helpdoc | table *]&lt;/P&gt;

&lt;P&gt;regards&lt;BR /&gt;
Ashley Pietersen&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:27:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-a-search-result-as-a-filename-variable-of-a/m-p/441162#M125345</guid>
      <dc:creator>apietersen</dc:creator>
      <dc:date>2020-09-29T20:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use a search result as a filename variable of a inputlookup  statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-a-search-result-as-a-filename-variable-of-a/m-p/441163#M125346</link>
      <description>&lt;P&gt;I do it like this on a dashboard:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup 
[ 
 | makeresults count=1 
 | eval env="$VARIABLE_FROM_DROPDOWN$"
 | eval lookupname=case
 (
  match(env,"prod.*"), "prod",
  match(env,"uat.*"), "uat",
  match(env,"qa.*"), "qa"
 ) 
 | fields lookupname 
 | return $lookupname 
] fieldInLookup AS fieldInData OUTPUTNEW fieldsFromLookup
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So to adapt it for your use case i think this would work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup
[
| makeresults 
| eval msgtxt="46 - No intervention needed" , msgcode=substr(msgtxt,0,2) 
| table msgcode
| lookup EVENTLIST_3v3 nr as msgcode OUTPUT helpdoc
| fields helpdoc
| return $helpdoc
] | table *
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Jul 2018 11:51:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-a-search-result-as-a-filename-variable-of-a/m-p/441163#M125346</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2018-07-19T11:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use a search result as a filename variable of a inputlookup  statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-a-search-result-as-a-filename-variable-of-a/m-p/441164#M125347</link>
      <description>&lt;P&gt;Hi jkat54,&lt;/P&gt;

&lt;P&gt;Thanks for the code, that was very helpful. this works fine for what I am trying to achieve,.&lt;/P&gt;

&lt;P&gt;I will need to look in to the details about your using "return $helpdoc"  and the fact that you start with inputlookup which is the other way around as I did. Thanks again!! &lt;/P&gt;

&lt;P&gt;My final code is now:&lt;/P&gt;

&lt;PRE&gt;|inputlookup
     [
     | makeresults 
     | eval msgtxt="$nr$" , msgcode=substr(msgtxt,5,2) 
     | table msgcode
     | lookup EVENTLIST_3v3 nr as msgcode OUTPUT helpdoc
     | fields helpdoc
     | return $helpdoc
     ] | table help&lt;/PRE&gt;

best regards
Ashley Pietersen</description>
      <pubDate>Fri, 20 Jul 2018 07:06:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-a-search-result-as-a-filename-variable-of-a/m-p/441164#M125347</guid>
      <dc:creator>apietersen</dc:creator>
      <dc:date>2018-07-20T07:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use a search result as a filename variable of a inputlookup  statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-a-search-result-as-a-filename-variable-of-a/m-p/441165#M125348</link>
      <description>&lt;P&gt;Glad to help.  &lt;/P&gt;

&lt;P&gt;The return and format commands are essential when using subsearches.&lt;/P&gt;

&lt;P&gt;Use this command reference for more details on those two commands:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/7.1.2/SearchReference/ListOfSearchCommands"&gt;http://docs.splunk.com/Documentation/Splunk/7.1.2/SearchReference/ListOfSearchCommands&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 10:57:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-a-search-result-as-a-filename-variable-of-a/m-p/441165#M125348</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2018-07-20T10:57:03Z</dc:date>
    </item>
  </channel>
</rss>

