<?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: Splunk script command in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-script-command/m-p/291830#M3662</link>
    <description>&lt;P&gt;cool....I am able to pass the arguments to external script but the can't add this to triggered alert action as results are always 0 though there's value. I guess it passes the arguments and cleans itself out? &lt;/P&gt;

&lt;P&gt;I run this &lt;CODE&gt;|gentimes start=-1|eval x=120|map search="|gentimes start=-1 | script python Hello $x$"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I get the values of x printed to a text file but results say 0. If i could get the results populated so that they are displayed in triggered alerts &amp;amp; pass arguments that would solve it all. And i would drive to Texas and buy you a beer :)...is it possible?&lt;/P&gt;</description>
    <pubDate>Fri, 24 Mar 2017 01:18:14 GMT</pubDate>
    <dc:creator>Raghav2384</dc:creator>
    <dc:date>2017-03-24T01:18:14Z</dc:date>
    <item>
      <title>Splunk script command</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-script-command/m-p/291826#M3658</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;

&lt;P&gt;I am trying to pass an argument to a python script using "script command"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|gentimes start=-1|eval x=120|script python Hello $x$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;throws me the following error (not sure how to make it an int from string on splunk side)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;External search command 'Hello' returned error code 1.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If i try the following, it works as expected&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|gentimes start=-1|eval x=120|script python Hello 120 -&amp;gt; Works
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;On the python side, if i say &lt;CODE&gt;if sys.argv[1] &amp;gt; 100&lt;/CODE&gt; &lt;CODE&gt;elif  sys.argv[1] &amp;lt;  100&lt;/CODE&gt; (creates a message based on the condition) will always generate same message even when &lt;STRONG&gt;elif condition is true&lt;/STRONG&gt;. I realized it's string and once i did &lt;CODE&gt;int(sys.argv[1])&lt;/CODE&gt; works on python side but not from splunk using &lt;CODE&gt;$x$&lt;/CODE&gt;. Could you please shed some light?&lt;/P&gt;

&lt;P&gt;Appreciate your help&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Raghav&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 23:27:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-script-command/m-p/291826#M3658</guid>
      <dc:creator>Raghav2384</dc:creator>
      <dc:date>2017-03-22T23:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk script command</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-script-command/m-p/291827#M3659</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|gentimes start=-1|eval x=120|map search="|gentimes start=-1 | script python Hello $x$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Mar 2017 00:00:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-script-command/m-p/291827#M3659</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-23T00:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk script command</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-script-command/m-p/291828#M3660</link>
      <description>&lt;P&gt;you gotta be kidding me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; that shed the exact amount of light i needed....Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 00:07:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-script-command/m-p/291828#M3660</guid>
      <dc:creator>Raghav2384</dc:creator>
      <dc:date>2017-03-23T00:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk script command</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-script-command/m-p/291829#M3661</link>
      <description>&lt;P&gt;You can also do this with a &lt;CODE&gt;subsearch&lt;/CODE&gt; but I am partial to &lt;CODE&gt;map&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 00:19:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-script-command/m-p/291829#M3661</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-23T00:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk script command</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-script-command/m-p/291830#M3662</link>
      <description>&lt;P&gt;cool....I am able to pass the arguments to external script but the can't add this to triggered alert action as results are always 0 though there's value. I guess it passes the arguments and cleans itself out? &lt;/P&gt;

&lt;P&gt;I run this &lt;CODE&gt;|gentimes start=-1|eval x=120|map search="|gentimes start=-1 | script python Hello $x$"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I get the values of x printed to a text file but results say 0. If i could get the results populated so that they are displayed in triggered alerts &amp;amp; pass arguments that would solve it all. And i would drive to Texas and buy you a beer :)...is it possible?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 01:18:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-script-command/m-p/291830#M3662</guid>
      <dc:creator>Raghav2384</dc:creator>
      <dc:date>2017-03-24T01:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk script command</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-script-command/m-p/291831#M3663</link>
      <description>&lt;P&gt;Here is the way to do it with a subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  |gentimes start=-1|eval x=120|script python Hello [|gentimes start=-1|eval x=120 | return $x]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Mar 2017 18:57:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-script-command/m-p/291831#M3663</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-24T18:57:30Z</dc:date>
    </item>
  </channel>
</rss>

