<?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: Custom script parameters in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384447#M6409</link>
    <description>&lt;P&gt;Been a while, here's what I remember. &lt;CODE&gt;Import sys&lt;/CODE&gt;. You can send in args via argv. &lt;CODE&gt;TEXTSTRING = sys.argv[1]&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Then when running the custom search command you just put 'em after the command. &lt;CODE&gt;| script myscript arg1 arg2 ...&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jun 2019 20:54:40 GMT</pubDate>
    <dc:creator>hallt3</dc:creator>
    <dc:date>2019-06-03T20:54:40Z</dc:date>
    <item>
      <title>How to pass the value of the field to the script as a parameter when customizing commands in Python?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384442#M6404</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;I have created a custom command in Python that needs a parameter, which is one of the fields of the search.&lt;/P&gt;
&lt;P&gt;The script is as the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;import splunk.Intersplunk

def foofunct(text):
     output = //Doing something with text
     return output

keywords, options = splunk.Intersplunk.getKeywordsAndOptions()

results,unused1,unused2 = splunk.Intersplunk.getOrganizedResults()

for result in results:
     result["foo"] = foofunct(keywords)
splunk.Intersplunk.outputResults(results)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When I insert the parameter directly in the tests, it works perfectly, but when I put the name of the field, it doesn't take the value of the field, it takes the name of the field as a parameter.&lt;/P&gt;
&lt;P&gt;Is there any way to pass the value of the field to the script as a parameter?&lt;/P&gt;
&lt;P&gt;Thanks for all.&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2020 23:04:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384442#M6404</guid>
      <dc:creator>pbalbasm</dc:creator>
      <dc:date>2020-06-17T23:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Custom script parameters</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384443#M6405</link>
      <description>&lt;P&gt;Why doesn't anybody help?&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jun 2019 18:20:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384443#M6405</guid>
      <dc:creator>highsplunker</dc:creator>
      <dc:date>2019-06-02T18:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Custom script parameters</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384444#M6406</link>
      <description>&lt;P&gt;How are you using this custom command in your searches?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 16:19:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384444#M6406</guid>
      <dc:creator>alonsocaio</dc:creator>
      <dc:date>2019-06-03T16:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Custom script parameters</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384445#M6407</link>
      <description>&lt;P&gt;The question is how to pass parameters in and out of custom python script. This script is just an example.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 16:37:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384445#M6407</guid>
      <dc:creator>highsplunker</dc:creator>
      <dc:date>2019-06-03T16:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Custom script parameters</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384446#M6408</link>
      <description>&lt;P&gt;I got it, but you said that when you put the name of the field as a parameter It does not get the field value, but the field name, so I am supposing you tried running this command from Splunk, right? If you tried running it from Splunk, I'd like to know how you used the command.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 16:40:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384446#M6408</guid>
      <dc:creator>alonsocaio</dc:creator>
      <dc:date>2019-06-03T16:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Custom script parameters</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384447#M6409</link>
      <description>&lt;P&gt;Been a while, here's what I remember. &lt;CODE&gt;Import sys&lt;/CODE&gt;. You can send in args via argv. &lt;CODE&gt;TEXTSTRING = sys.argv[1]&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Then when running the custom search command you just put 'em after the command. &lt;CODE&gt;| script myscript arg1 arg2 ...&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 20:54:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384447#M6409</guid>
      <dc:creator>hallt3</dc:creator>
      <dc:date>2019-06-03T20:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Custom script parameters</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384448#M6410</link>
      <description>&lt;P&gt;For me, the solution was to create a Javascript in the view wich launches a search with the correct parameters, so the keywords are values taken directly from the javascript.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 08:37:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-pass-the-value-of-the-field-to-the-script-as-a-parameter/m-p/384448#M6410</guid>
      <dc:creator>pbalbasm</dc:creator>
      <dc:date>2019-06-04T08:37:13Z</dc:date>
    </item>
  </channel>
</rss>

