<?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: How do you run a script from an alert? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-do-you-run-a-script-from-an-alert/m-p/435470#M7584</link>
    <description>&lt;P&gt;Hello @robertlynch2020,&lt;/P&gt;

&lt;P&gt;I see you are using a relative path (echo ... &amp;gt;&amp;gt; Date_test.log). Try using an absolute path instead.&lt;/P&gt;

&lt;P&gt;See &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Alert/Configuringscriptedalerts"&gt;Working directories for scripts&lt;/A&gt;:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Specify an absolute path whenever a path is needed. If you use relative paths, it is important to remember that they are rooted in the &lt;STRONG&gt;Search and Reporting&lt;/STRONG&gt; app's &lt;STRONG&gt;bin&lt;/STRONG&gt; folder.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Wed, 12 Dec 2018 18:47:44 GMT</pubDate>
    <dc:creator>whrg</dc:creator>
    <dc:date>2018-12-12T18:47:44Z</dc:date>
    <item>
      <title>How do you run a script from an alert?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-you-run-a-script-from-an-alert/m-p/435469#M7583</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I am trying to run a basic script from an alert in /apps/splunk/bin/scripts/TEST_SCRIPT.sh&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!/bin/sh
DATE=`date '+%Y-%m-%d %H:%M:%S'`
echo $DATE  &amp;gt;&amp;gt; Date_test.log
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am getting the following output, but the file Date_test.log is not getting bigger. When i run it manually i get output.&lt;/P&gt;

&lt;P&gt;Any ideas? I am in Splunk 7.0.3&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2018-12-12 16:44:02,093 +0100 INFO  runshellscript:222 - runshellscript: ['/bin/sh', '/hp737srv2/apps/splunk/bin/scripts/TEST_SCRIPT.sh', '6', '| tstats count where index="mlc_live"  sourcetype="TPS" by _indextime host \n\t\t  | stats sum(count) as No_Of_TPS_lines max(_indextime) as TIME by host  \n\t\t  | eval TIME=strftime(TIME,"%Y-%m-%d %H:%M:%S") \n\t\t  | sort - host \n\t\t  | table host No_Of_TPS_lines TIME', '| tstats count where index="mlc_live"  sourcetype="TPS" by _indextime host \n\t\t  | stats sum(count) as No_Of_TPS_lines max(_indextime) as TIME by host  \n\t\t  | eval TIME=strftime(TIME,"%Y-%m-%d %H:%M:%S") \n\t\t  | sort - host \n\t\t  | table host No_Of_TPS_lines TIME', 'SCRIPT_TEST', 'Saved Search [SCRIPT_TEST] number of events(6)', 'http://dell425srv:8000/app/murex_mlc/@go?sid=scheduler__admin_bXVyZXhfbWxj__RMD5a63ba5c7fea78f6c_at_1544629440_52364', '', '/hp737srv2/apps/splunk/var/run/splunk/dispatch/scheduler__admin_bXVyZXhfbWxj__RMD5a63ba5c7fea78f6c_at_1544629440_52364/results.csv.gz']
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Dec 2018 16:02:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-you-run-a-script-from-an-alert/m-p/435469#M7583</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2018-12-12T16:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do you run a script from an alert?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-you-run-a-script-from-an-alert/m-p/435470#M7584</link>
      <description>&lt;P&gt;Hello @robertlynch2020,&lt;/P&gt;

&lt;P&gt;I see you are using a relative path (echo ... &amp;gt;&amp;gt; Date_test.log). Try using an absolute path instead.&lt;/P&gt;

&lt;P&gt;See &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Alert/Configuringscriptedalerts"&gt;Working directories for scripts&lt;/A&gt;:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Specify an absolute path whenever a path is needed. If you use relative paths, it is important to remember that they are rooted in the &lt;STRONG&gt;Search and Reporting&lt;/STRONG&gt; app's &lt;STRONG&gt;bin&lt;/STRONG&gt; folder.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 12 Dec 2018 18:47:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-you-run-a-script-from-an-alert/m-p/435470#M7584</guid>
      <dc:creator>whrg</dc:creator>
      <dc:date>2018-12-12T18:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do you run a script from an alert?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-you-run-a-script-from-an-alert/m-p/435471#M7585</link>
      <description>&lt;P&gt;cheers that worked perfect &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 10:43:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-you-run-a-script-from-an-alert/m-p/435471#M7585</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2018-12-13T10:43:37Z</dc:date>
    </item>
  </channel>
</rss>

