<?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 to pass our command line arguments to script called from Splunk for alert triggered in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-pass-our-command-line-arguments-to-script-called-from/m-p/85936#M1194</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I configured an Alert for some search and configured perl script to be called when Alert is triggered. I understand by default Splunk sends some values as command line arguments to script (Ref: &lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0/Alert/Configuringscriptedalerts"&gt;http://docs.splunk.com/Documentation/Splunk/5.0/Alert/Configuringscriptedalerts&lt;/A&gt; ).&lt;/P&gt;

&lt;P&gt;My questions are here:&lt;BR /&gt;
 1. Can I pass my own values (not fixed values) to script as command line argument? The values may be derived from search and hence may change everytime.&lt;BR /&gt;
 2. Is there any limits for passing command line arguments to script from Splunk?&lt;/P&gt;

&lt;P&gt;If someone answers with examples helps lot to many splunk users.&lt;/P&gt;

&lt;P&gt;Regards&lt;BR /&gt;
Jay&lt;/P&gt;</description>
    <pubDate>Fri, 05 Apr 2013 12:49:07 GMT</pubDate>
    <dc:creator>jayannah</dc:creator>
    <dc:date>2013-04-05T12:49:07Z</dc:date>
    <item>
      <title>How to pass our command line arguments to script called from Splunk for alert triggered</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-pass-our-command-line-arguments-to-script-called-from/m-p/85936#M1194</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I configured an Alert for some search and configured perl script to be called when Alert is triggered. I understand by default Splunk sends some values as command line arguments to script (Ref: &lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0/Alert/Configuringscriptedalerts"&gt;http://docs.splunk.com/Documentation/Splunk/5.0/Alert/Configuringscriptedalerts&lt;/A&gt; ).&lt;/P&gt;

&lt;P&gt;My questions are here:&lt;BR /&gt;
 1. Can I pass my own values (not fixed values) to script as command line argument? The values may be derived from search and hence may change everytime.&lt;BR /&gt;
 2. Is there any limits for passing command line arguments to script from Splunk?&lt;/P&gt;

&lt;P&gt;If someone answers with examples helps lot to many splunk users.&lt;/P&gt;

&lt;P&gt;Regards&lt;BR /&gt;
Jay&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2013 12:49:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-pass-our-command-line-arguments-to-script-called-from/m-p/85936#M1194</guid>
      <dc:creator>jayannah</dc:creator>
      <dc:date>2013-04-05T12:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass our command line arguments to script called from Splunk for alert triggered</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-pass-our-command-line-arguments-to-script-called-from/m-p/85937#M1195</link>
      <description>&lt;P&gt;First of all, if these are not 'fixed' how are they going to be set? Scripted alerts are launched by an instance of a Splunk saved search. Where would the instance of the search get these varying parameters?&lt;/P&gt;

&lt;P&gt;Generally, you can have parameters that are fixed (simply by wrapping them in simple script, for example) or that vary by the saved search definition (by either using alert_actions.conf or by performing logic in the wrapper script), or you can have instance-specific actions by having your script use the documented parameters or the results file.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2013 17:22:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-pass-our-command-line-arguments-to-script-called-from/m-p/85937#M1195</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2013-04-05T17:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass our command line arguments to script called from Splunk for alert triggered</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-pass-our-command-line-arguments-to-script-called-from/m-p/85938#M1196</link>
      <description>&lt;P&gt;Thanks for the response gkanapathy.&lt;/P&gt;

&lt;P&gt;If I configure the alert to call the script, Splunk tool passes complete results as argument. But, I want to pass only few values extracted from result to script.&lt;/P&gt;

&lt;P&gt;Here my scenario&lt;BR /&gt;
1. I will issue the following search in Splunk. The result will have host and source parameters &amp;amp; its values. I want to call python script with parameters host &amp;amp; source values.&lt;/P&gt;

&lt;P&gt;Spunk Search:&lt;BR /&gt;
source="D:\Splunk\sample-log.txt" shutdown | script python myPythonScript &amp;lt;&lt;HOST-VALUE&gt;&amp;gt; &amp;lt;&lt;SOURCE-VALUE&gt;&amp;gt;&lt;/SOURCE-VALUE&gt;&lt;/HOST-VALUE&gt;&lt;/P&gt;

&lt;P&gt;Can you please explain how to call the values from result to the python script?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2013 11:50:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-pass-our-command-line-arguments-to-script-called-from/m-p/85938#M1196</guid>
      <dc:creator>jayannah</dc:creator>
      <dc:date>2013-04-08T11:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass our command line arguments to script called from Splunk for alert triggered</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-pass-our-command-line-arguments-to-script-called-from/m-p/85939#M1197</link>
      <description>&lt;P&gt;Have a look here: &lt;BR /&gt;
&lt;A href="http://splunk-base.splunk.com/answers/88934/pass-variable-to-a-scripted-alert"&gt;http://splunk-base.splunk.com/answers/88934/pass-variable-to-a-scripted-alert&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2013 21:46:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-pass-our-command-line-arguments-to-script-called-from/m-p/85939#M1197</guid>
      <dc:creator>Mathieu_Dessus</dc:creator>
      <dc:date>2013-06-07T21:46:59Z</dc:date>
    </item>
  </channel>
</rss>

