<?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 Executing python script as an alert action on windows in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Executing-python-script-as-an-alert-action-on-windows/m-p/574546#M101562</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have to run python script as an alert action. My Splunk is on windows.&lt;/P&gt;&lt;P&gt;I tried my script running like this and its working. Its very basic hello world script.&lt;BR /&gt;&lt;BR /&gt;C:\Program Files\Splunk\bin&amp;gt;splunk cmd python hello_world.py&lt;BR /&gt;This message will be displayed on the screen.&lt;BR /&gt;&lt;BR /&gt;commands.conf&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;[hello_world]&lt;BR /&gt;filename = hello_world.py&lt;BR /&gt;&lt;BR /&gt;I have placed commands.conf in&amp;nbsp;C:\Program Files\Splunk\etc\apps\search\local and&amp;nbsp;C:\Program Files\Splunk\etc\system\local&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;when I am trying running this script from command line&amp;nbsp; its not working.&lt;BR /&gt;| script python hello_world&amp;nbsp;&lt;BR /&gt;OR&lt;BR /&gt;| script hello_world&lt;BR /&gt;&lt;BR /&gt;Error Message:&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;Error in 'script' command: Cannot find program 'hello_world' or script 'hello_world'.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Not sure why its not be able to find the script. I have placed it to multiple location.&lt;BR /&gt;$SPLUNK_HOME$\etc\apps\search\bin\scripts\hello_world.py&lt;BR /&gt;$SPLUNK_HOME$\bin\hello_world.py&amp;nbsp; &amp;nbsp;(from command line it take this script)&lt;BR /&gt;&lt;BR /&gt;My ultimate goal is to run this script as an alert action. but I dont think there is option to run python script. I have option as run a script but seems like that is only for shell script.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Nov 2021 11:33:02 GMT</pubDate>
    <dc:creator>AKG1_old1</dc:creator>
    <dc:date>2021-11-11T11:33:02Z</dc:date>
    <item>
      <title>Executing python script as an alert action on windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Executing-python-script-as-an-alert-action-on-windows/m-p/574546#M101562</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have to run python script as an alert action. My Splunk is on windows.&lt;/P&gt;&lt;P&gt;I tried my script running like this and its working. Its very basic hello world script.&lt;BR /&gt;&lt;BR /&gt;C:\Program Files\Splunk\bin&amp;gt;splunk cmd python hello_world.py&lt;BR /&gt;This message will be displayed on the screen.&lt;BR /&gt;&lt;BR /&gt;commands.conf&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;[hello_world]&lt;BR /&gt;filename = hello_world.py&lt;BR /&gt;&lt;BR /&gt;I have placed commands.conf in&amp;nbsp;C:\Program Files\Splunk\etc\apps\search\local and&amp;nbsp;C:\Program Files\Splunk\etc\system\local&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;when I am trying running this script from command line&amp;nbsp; its not working.&lt;BR /&gt;| script python hello_world&amp;nbsp;&lt;BR /&gt;OR&lt;BR /&gt;| script hello_world&lt;BR /&gt;&lt;BR /&gt;Error Message:&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;Error in 'script' command: Cannot find program 'hello_world' or script 'hello_world'.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Not sure why its not be able to find the script. I have placed it to multiple location.&lt;BR /&gt;$SPLUNK_HOME$\etc\apps\search\bin\scripts\hello_world.py&lt;BR /&gt;$SPLUNK_HOME$\bin\hello_world.py&amp;nbsp; &amp;nbsp;(from command line it take this script)&lt;BR /&gt;&lt;BR /&gt;My ultimate goal is to run this script as an alert action. but I dont think there is option to run python script. I have option as run a script but seems like that is only for shell script.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 11:33:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Executing-python-script-as-an-alert-action-on-windows/m-p/574546#M101562</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2021-11-11T11:33:02Z</dc:date>
    </item>
  </channel>
</rss>

