<?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 Can not run a simple action script in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Can-not-run-a-simple-action-script/m-p/337656#M5965</link>
    <description>&lt;P&gt;Hello Team,&lt;/P&gt;

&lt;P&gt;Troubleshooting for few hours the most basic script executed as the action.&lt;/P&gt;

&lt;P&gt;Trying manually (search returning ~90 results):&lt;BR /&gt;
sourcetype="cisco:ios" | runshellscript create_inc.sh arg1 arg2 arg3 arg4 arg5 arg6 arg7 "/tmp/test"&lt;BR /&gt;
got the response: create_inc.sh exited with status code: 1&lt;/P&gt;

&lt;P&gt;The script create_inc.sh content:&lt;BR /&gt;
cp $8 &amp;gt;/tmp/ttt&lt;BR /&gt;
(script is executable)&lt;/P&gt;

&lt;P&gt;I have  /tmp/test readable by all.&lt;BR /&gt;
As a result i  see /tmp/ttt created (it was not existing) but it's empty. Why ?&lt;/P&gt;

&lt;P&gt;I want to write mode advanced script like this one:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/149836/how-to-run-an-alert-script-on-field-values-generated-in-splunk.html" target="_blank"&gt;https://answers.splunk.com/answers/149836/how-to-run-an-alert-script-on-field-values-generated-in-splunk.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;But can not get the simplest script tested. I have followed troubleshooting guide:&lt;BR /&gt;
&lt;A href="http://wiki.splunk.com/Community:TroubleshootingAlertScripts" target="_blank"&gt;http://wiki.splunk.com/Community:TroubleshootingAlertScripts&lt;/A&gt;&lt;BR /&gt;
But it's not really helpful. &lt;/P&gt;

&lt;P&gt;Could you please help me with this most basic script ?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Michal&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 19:02:39 GMT</pubDate>
    <dc:creator>teknet9</dc:creator>
    <dc:date>2020-09-29T19:02:39Z</dc:date>
    <item>
      <title>Can not run a simple action script</title>
      <link>https://community.splunk.com/t5/Alerting/Can-not-run-a-simple-action-script/m-p/337656#M5965</link>
      <description>&lt;P&gt;Hello Team,&lt;/P&gt;

&lt;P&gt;Troubleshooting for few hours the most basic script executed as the action.&lt;/P&gt;

&lt;P&gt;Trying manually (search returning ~90 results):&lt;BR /&gt;
sourcetype="cisco:ios" | runshellscript create_inc.sh arg1 arg2 arg3 arg4 arg5 arg6 arg7 "/tmp/test"&lt;BR /&gt;
got the response: create_inc.sh exited with status code: 1&lt;/P&gt;

&lt;P&gt;The script create_inc.sh content:&lt;BR /&gt;
cp $8 &amp;gt;/tmp/ttt&lt;BR /&gt;
(script is executable)&lt;/P&gt;

&lt;P&gt;I have  /tmp/test readable by all.&lt;BR /&gt;
As a result i  see /tmp/ttt created (it was not existing) but it's empty. Why ?&lt;/P&gt;

&lt;P&gt;I want to write mode advanced script like this one:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/149836/how-to-run-an-alert-script-on-field-values-generated-in-splunk.html" target="_blank"&gt;https://answers.splunk.com/answers/149836/how-to-run-an-alert-script-on-field-values-generated-in-splunk.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;But can not get the simplest script tested. I have followed troubleshooting guide:&lt;BR /&gt;
&lt;A href="http://wiki.splunk.com/Community:TroubleshootingAlertScripts" target="_blank"&gt;http://wiki.splunk.com/Community:TroubleshootingAlertScripts&lt;/A&gt;&lt;BR /&gt;
But it's not really helpful. &lt;/P&gt;

&lt;P&gt;Could you please help me with this most basic script ?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Michal&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:02:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Can-not-run-a-simple-action-script/m-p/337656#M5965</guid>
      <dc:creator>teknet9</dc:creator>
      <dc:date>2020-09-29T19:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can not run a simple action script</title>
      <link>https://community.splunk.com/t5/Alerting/Can-not-run-a-simple-action-script/m-p/337657#M5966</link>
      <description>&lt;P&gt;Sorry, a small update, i had a typoo in my script,&lt;BR /&gt;
now i have:&lt;BR /&gt;
sourcetype="cisco:ios" | runshellscript create_inc.sh arg1 arg2 arg3 arg4 arg5 arg6 arg7 "/tmp/test.gz"&lt;/P&gt;

&lt;P&gt;Exiting with code 2.&lt;/P&gt;

&lt;P&gt;While if i execute from shell:&lt;BR /&gt;
./create_inc.sh arg1 arg2 arg3 a4 a5 a6 a7 /tmp/test.gz&lt;/P&gt;

&lt;P&gt;Everything is working fine (my code is executed, file decopressed and so on).&lt;BR /&gt;
I have my script in /opt/splunk/bin/script &lt;/P&gt;

&lt;P&gt;code 2 suggest splunk can not find the script ? Why ?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Apr 2018 16:59:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Can-not-run-a-simple-action-script/m-p/337657#M5966</guid>
      <dc:creator>teknet9</dc:creator>
      <dc:date>2018-04-16T16:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Can not run a simple action script</title>
      <link>https://community.splunk.com/t5/Alerting/Can-not-run-a-simple-action-script/m-p/337658#M5967</link>
      <description>&lt;P&gt;Hi teknet9,&lt;/P&gt;

&lt;P&gt;It is described in Splunk docs that &lt;CODE&gt;runshellscript&lt;/CODE&gt; is not a supported search command:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.0.3/SearchReference/Runshellscript"&gt;https://docs.splunk.com/Documentation/Splunk/7.0.3/SearchReference/Runshellscript&lt;/A&gt;&lt;BR /&gt;
This is most likely why your method does not work. arg8 is supposed to be the path to the search results passed by Splunk, and you are manually providing a path where the results should not be.&lt;/P&gt;

&lt;P&gt;To test your script I would suggest setting up an alert with a script action (your script). &lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 09:08:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Can-not-run-a-simple-action-script/m-p/337658#M5967</guid>
      <dc:creator>damien_chillet</dc:creator>
      <dc:date>2018-04-17T09:08:17Z</dc:date>
    </item>
  </channel>
</rss>

