<?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: Missing --execute Argument  in Custom Alert App in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Missing-execute-Argument-in-Custom-Alert-App/m-p/634854#M14907</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/253046"&gt;@secphilomath1&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;After you configure a test alert and define your custom alert action as a triggered action, when Splunk calls the alert action script it passes the --execute as the first command line parameter.&lt;/P&gt;&lt;P&gt;&lt;A href="https://dev.splunk.com/enterprise/docs/devtools/customalertactions/writescriptcaa" target="_blank" rel="noopener"&gt;https://dev.splunk.com/enterprise/docs/devtools/customalertactions/writescriptcaa&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yeahnah_0-1679010305411.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24349i829703F23AE5CB8B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yeahnah_0-1679010305411.png" alt="yeahnah_0-1679010305411.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Basically, something like this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; python _myalertscript.py_ --execute &amp;lt; _myalert_result_payload.json_&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How are you testing you alerting script?&lt;/P&gt;</description>
    <pubDate>Thu, 16 Mar 2023 23:55:53 GMT</pubDate>
    <dc:creator>yeahnah</dc:creator>
    <dc:date>2023-03-16T23:55:53Z</dc:date>
    <item>
      <title>Missing --execute Argument  in Custom Alert App</title>
      <link>https://community.splunk.com/t5/Alerting/Missing-execute-Argument-in-Custom-Alert-App/m-p/634834#M14906</link>
      <description>&lt;P&gt;I am working on a custom alert app to replace our old custom alert script action.&amp;nbsp; It was working fine but all of sudden I am no longer getting the --execute argument being passed and my script doesn't work any more.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if __name__ == "__main__":

    #clear logs
    now = datetime.now()
    dt_string = now.strftime("%d/%m/%Y %H:%M:%S")

    log(dt_string + ":  Start Version 1.2","w")


    log("Checking to see if we have any arguments...")

    log("Number of arguments: " + str(len(sys.argv)))
    
    if len(sys.argv) &amp;gt; 1 and sys.argv[1] == "--execute":
        log("We have arguments.")

        try:
            payload = json.loads(sys.stdin.read())

            result_file = payload['results_file']

            #Pass the payload to main for processing....
            main(payload)

            #End
            now = datetime.now()
            dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
            log(dt_string + ": Processing complete.")


        except:
            log("We have an error on settings, exiting")
            sys.exit()

    else:
        log("There were no arguments.  Exiting.")

    sys.exit()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the output of my logging:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;16/03/2023 10:55:16:  Start Version 1.2

Checking to see if we have any arguments...

Number of arguments: 1

There were no arguments.  Exiting.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have no idea what the --execute argument is and how it is passed, or what it actually means and can't find anything much about it&amp;nbsp; Hoping to shed some light here&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 20:37:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Missing-execute-Argument-in-Custom-Alert-App/m-p/634834#M14906</guid>
      <dc:creator>secphilomath1</dc:creator>
      <dc:date>2023-03-16T20:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Missing --execute Argument  in Custom Alert App</title>
      <link>https://community.splunk.com/t5/Alerting/Missing-execute-Argument-in-Custom-Alert-App/m-p/634854#M14907</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/253046"&gt;@secphilomath1&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;After you configure a test alert and define your custom alert action as a triggered action, when Splunk calls the alert action script it passes the --execute as the first command line parameter.&lt;/P&gt;&lt;P&gt;&lt;A href="https://dev.splunk.com/enterprise/docs/devtools/customalertactions/writescriptcaa" target="_blank" rel="noopener"&gt;https://dev.splunk.com/enterprise/docs/devtools/customalertactions/writescriptcaa&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yeahnah_0-1679010305411.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24349i829703F23AE5CB8B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yeahnah_0-1679010305411.png" alt="yeahnah_0-1679010305411.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Basically, something like this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; python _myalertscript.py_ --execute &amp;lt; _myalert_result_payload.json_&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How are you testing you alerting script?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 23:55:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Missing-execute-Argument-in-Custom-Alert-App/m-p/634854#M14907</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2023-03-16T23:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Missing --execute Argument  in Custom Alert App</title>
      <link>https://community.splunk.com/t5/Alerting/Missing-execute-Argument-in-Custom-Alert-App/m-p/634855#M14908</link>
      <description>&lt;P&gt;Cool thanks for the reference info, but mine all of a sudden isn't passing the --execute and then is failing.&amp;nbsp; Can you think of a reason why it wouldn't pass that, the script is being called by the custom alert app.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 23:57:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Missing-execute-Argument-in-Custom-Alert-App/m-p/634855#M14908</guid>
      <dc:creator>secphilomath1</dc:creator>
      <dc:date>2023-03-16T23:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Missing --execute Argument  in Custom Alert App</title>
      <link>https://community.splunk.com/t5/Alerting/Missing-execute-Argument-in-Custom-Alert-App/m-p/634857#M14909</link>
      <description>&lt;P&gt;That sounds weird alright.&lt;BR /&gt;&lt;BR /&gt;I guess you've tried a Splunk restart?&lt;BR /&gt;&lt;BR /&gt;What do the internal logs show (Settings &amp;gt; Alert actions &amp;gt; View log events).&amp;nbsp; Any errors showing up?&lt;BR /&gt;&lt;BR /&gt;Also, the new Slunk Dev Portal docs are pretty poor.&amp;nbsp; The old docs were better.&amp;nbsp; I found an archived copy here, if that helps.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://web.archive.org/web/20220519181621/http://docs.splunk.com:80/Documentation/Splunk/latest/AdvancedDev/CustomAlertScript" target="_blank"&gt;http://web.archive.org/web/20220519181621/http://docs.splunk.com:80/Documentation/Splunk/latest/AdvancedDev/CustomAlertScript&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2023 01:11:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Missing-execute-Argument-in-Custom-Alert-App/m-p/634857#M14909</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2023-03-17T01:11:36Z</dc:date>
    </item>
  </channel>
</rss>

