<?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 add validation for multiple parameters in custom alert action in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404407#M11752</link>
    <description>&lt;P&gt;I have created a custom alert action which has 7-8 parameters. I have added few of them as below but this does not seems to be the correct way as the only last parameter is validated in this case.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[validation:savedsearch]
# Require parameters to be set if webhook action is enabled
action.snow_webhook = case('action.snow_webhook' != "1", null(), 'action.snow_webhook.param.url' == "action.snow_webhook.param.url" OR 'action.snow_webhook.param.url' == "", "No Webhook URL specified", 1==1, null())
action.snow_webhook = case('action.snow_webhook' != "1", null(), 'action.snow_webhook.param.assignment_group' == "action.snow_webhook.param.assignment_group" OR 'action.snow_webhook.param.assignment_group' == "", "Assignment Group cannot be empty", 1==1, null())
action.snow_webhook = case('action.snow_webhook' != "1", null(), 'action.snow_webhook.param.service_offering' == "action.snow_webhook.param.service_offering" OR 'action.snow_webhook.param.service_offering' == "", "Service Offering cannot be empty", 1==1, null())
action.snow_webhook = case('action.snow_webhook' != "1", null(), 'action.snow_webhook.param.description' == "action.snow_webhook.param.description" OR 'action.snow_webhook.param.description' == "", "Description cannot be empty", 1==1, null())
action.snow_webhook.param.url = validate(match('action.snow_webhook.param.url', "^https?://[^\s]+$"), "Webhook URL is invalid")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried to club those all in single statement like below, but this is also not working.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;action.snow_webhook = case('action.snow_webhook'!= "1", null(), 'action.snow_webhook.param.url' == "action.snow_webhook.param.url" OR 'action.snow_webhook.param.url' == "", "No Webhook URL specified", 'action.snow_webhook.param.service_offering' == "action.snow_webhook.param.service_offering" OR 'action.snow_webhook.param.service_offering' == "", "No Service Offering specified", 1==1, null())
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can any one help me with how to achieve this?&lt;/P&gt;</description>
    <pubDate>Thu, 21 Feb 2019 13:45:05 GMT</pubDate>
    <dc:creator>santosh_sshanbh</dc:creator>
    <dc:date>2019-02-21T13:45:05Z</dc:date>
    <item>
      <title>How to add validation for multiple parameters in custom alert action</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404407#M11752</link>
      <description>&lt;P&gt;I have created a custom alert action which has 7-8 parameters. I have added few of them as below but this does not seems to be the correct way as the only last parameter is validated in this case.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[validation:savedsearch]
# Require parameters to be set if webhook action is enabled
action.snow_webhook = case('action.snow_webhook' != "1", null(), 'action.snow_webhook.param.url' == "action.snow_webhook.param.url" OR 'action.snow_webhook.param.url' == "", "No Webhook URL specified", 1==1, null())
action.snow_webhook = case('action.snow_webhook' != "1", null(), 'action.snow_webhook.param.assignment_group' == "action.snow_webhook.param.assignment_group" OR 'action.snow_webhook.param.assignment_group' == "", "Assignment Group cannot be empty", 1==1, null())
action.snow_webhook = case('action.snow_webhook' != "1", null(), 'action.snow_webhook.param.service_offering' == "action.snow_webhook.param.service_offering" OR 'action.snow_webhook.param.service_offering' == "", "Service Offering cannot be empty", 1==1, null())
action.snow_webhook = case('action.snow_webhook' != "1", null(), 'action.snow_webhook.param.description' == "action.snow_webhook.param.description" OR 'action.snow_webhook.param.description' == "", "Description cannot be empty", 1==1, null())
action.snow_webhook.param.url = validate(match('action.snow_webhook.param.url', "^https?://[^\s]+$"), "Webhook URL is invalid")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried to club those all in single statement like below, but this is also not working.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;action.snow_webhook = case('action.snow_webhook'!= "1", null(), 'action.snow_webhook.param.url' == "action.snow_webhook.param.url" OR 'action.snow_webhook.param.url' == "", "No Webhook URL specified", 'action.snow_webhook.param.service_offering' == "action.snow_webhook.param.service_offering" OR 'action.snow_webhook.param.service_offering' == "", "No Service Offering specified", 1==1, null())
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can any one help me with how to achieve this?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 13:45:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404407#M11752</guid>
      <dc:creator>santosh_sshanbh</dc:creator>
      <dc:date>2019-02-21T13:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to add validation for multiple parameters in custom alert action</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404408#M11753</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can you please try below config, it should work (This is same as you have provided in single line)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;action.snow_webhook = case('action.snow_webhook' != "1", null(), 'action.snow_webhook.param.url' == "action.snow_webhook.param.url" OR 'action.snow_webhook.param.url' == "", "No Webhook URL specified", 'action.snow_webhook.param.assignment_group' == "action.snow_webhook.param.assignment_group" OR 'action.snow_webhook.param.assignment_group' == "", "Assignment Group cannot be empty", 'action.snow_webhook.param.service_offering' == "action.snow_webhook.param.service_offering" OR 'action.snow_webhook.param.service_offering' == "", "Service Offering cannot be empty", 'action.snow_webhook.param.description' == "action.snow_webhook.param.description" OR 'action.snow_webhook.param.description' == "", "Description cannot be empty", 1==1, null())
action.snow_webhook.param.url = validate(match('action.snow_webhook.param.url', "^https?://[^\s]+$"), "Webhook URL is invalid")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;EDIT: If above config will not work then can you please provide your alert_actions.conf (mask any sensitive data) ?&lt;/P&gt;

&lt;P&gt;Additionally after every change in restmap.conf you need to restart splunk to take new configuration in effect.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 13:51:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404408#M11753</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-02-21T13:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to add validation for multiple parameters in custom alert action</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404409#M11754</link>
      <description>&lt;P&gt;I tried above config and restarted splunk but still no success. I am keep on getting error 'Assignment Group cannot be empty' even though I enter something in the Assignment Group text box.&lt;/P&gt;

&lt;P&gt;Below are my config files&lt;/P&gt;

&lt;H2&gt;restmap.conf&lt;/H2&gt;

&lt;PRE&gt;&lt;CODE&gt;[validation:savedsearch]
# Require parameters to be set if webhook action is enabled
action.snow_webhook = case('action.snow_webhook' != "1", null(), 'action.snow_webhook.param.url' == "action.snow_webhook.param.url" OR 'action.snow_webhook.param.url' == "", "No Webhook URL specified", 'action.snow_webhook.param.assignment_group' == "action.snow_webhook.param.assignment_group" OR 'action.snow_webhook.param.assignment_group' == "", "Assignment Group cannot be empty", 'action.snow_webhook.param.service_offering' == "action.snow_webhook.param.service_offering" OR 'action.snow_webhook.param.service_offering' == "", "Service Offering cannot be empty", 'action.snow_webhook.param.description' == "action.snow_webhook.param.description" OR 'action.snow_webhook.param.description' == "", "Description cannot be empty", 1==1, null())
action.snow_webhook.param.url = validate(match('action.snow_webhook.param.url', "^https?://[^\s]+$"), "Webhook URL is invalid")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H2&gt;alert_actions.conf&lt;/H2&gt;

&lt;PRE&gt;&lt;CODE&gt;[snow_webhook]
is_custom = 1
label = Test Webhook
description = Call REST API POST URL
icon_path = webhook.png
payload_format = json
disabled = 0
param.user_agent = Splunk/$server.guid$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H2&gt;savedsearches.conf.spec&lt;/H2&gt;

&lt;PRE&gt;&lt;CODE&gt;# Webhook alert action settings

action.snow_webhook = [0|1]
* Enable webhook action

action.snow_webhook.param.url = 
* URL to send the HTTP POST request to. Must be accessible from the Splunk server.

action.snow_webhook.param.assignment_group = 
* Assignment Group in SNOW. Must be accessible from the Splunk server.

action.snow_webhook.param.service_offering = 
* Service Offering in SNOW. Must be accessible from the Splunk server.

action.snow_webhook.param.description = 
* Incident description in SNOW. Must be accessible from the Splunk server.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Feb 2019 07:14:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404409#M11754</guid>
      <dc:creator>santosh_sshanbh</dc:creator>
      <dc:date>2019-02-22T07:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to add validation for multiple parameters in custom alert action</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404410#M11755</link>
      <description>&lt;P&gt;Everything looks good. I'll suggest to check whether splunk is picking correct config or not using btool, if everything looks good then enable DEBUG logging for &lt;CODE&gt;AdminManager&lt;/CODE&gt; and check DEBUG logs.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 14:13:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404410#M11755</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-02-22T14:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to add validation for multiple parameters in custom alert action</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404411#M11756</link>
      <description>&lt;P&gt;I checked and correct conf files are loaded. However, setting the DEBUG mode for AdminMnager I saw below error in Splunkd.&lt;/P&gt;

&lt;P&gt;02-26-2019 12:52:50.966 +0000 DEBUG AdminManager - URI /en-US/splunkd/__raw/servicesNS/myuser/search/saved/searches/Test%20ServiceNow generated an AdminManagerExceptionBase exception in handler 'savedsearch': Assignment Group cannot be empty&lt;/P&gt;

&lt;P&gt;Any idea what this error could be?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 12:56:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404411#M11756</guid>
      <dc:creator>santosh_sshanbh</dc:creator>
      <dc:date>2019-02-26T12:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to add validation for multiple parameters in custom alert action</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404412#M11757</link>
      <description>&lt;P&gt;That error message saying that &lt;CODE&gt;Assignment Group cannot be empty&lt;/CODE&gt; which you already got while assigning Alert Actions to the saved search. Can you please try to create new scheduled search and try to check whether you are getting same error or not while assigning custom alert action ?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 13:17:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404412#M11757</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-02-26T13:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to add validation for multiple parameters in custom alert action</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404413#M11758</link>
      <description>&lt;P&gt;The error I am getting is not during run time while the alert is triggered. I have added some validations to make sure that mandatory fields are set while configuring the alert ltself. The error message 'Assignment Group cannot be empty' is shown on the Alert Configuration screen itself.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 13:21:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404413#M11758</guid>
      <dc:creator>santosh_sshanbh</dc:creator>
      <dc:date>2019-02-26T13:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to add validation for multiple parameters in custom alert action</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404414#M11759</link>
      <description>&lt;P&gt;Yes I know that you are getting error while configuring custom alert action for Scheduled search. Can you please create fresh new scheduled search and try to assign custom alert action to that search ?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 13:23:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404414#M11759</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-02-26T13:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to add validation for multiple parameters in custom alert action</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404415#M11760</link>
      <description>&lt;P&gt;I created a new alert from scratch and tried to configure the custom alert. But getting same issue. Basically once the error is set, even though the value is entered for the associated control (text box), the error is not resetting. &lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 13:31:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404415#M11760</guid>
      <dc:creator>santosh_sshanbh</dc:creator>
      <dc:date>2019-02-26T13:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to add validation for multiple parameters in custom alert action</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404416#M11761</link>
      <description>&lt;P&gt;So does this mean that if you assign values in all text boxes from prior then no error will generate and alert action save with values and run properly on scheduled intervals ? What splunk version are you using  and windows or linux ?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 13:33:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404416#M11761</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-02-26T13:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to add validation for multiple parameters in custom alert action</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404417#M11762</link>
      <description>&lt;P&gt;No. Even for the very first time though all text boxes are entered with some text, it is giving an error for 2nd control which is assignment group.&lt;/P&gt;

&lt;P&gt;I have Splunk 7.2.3 on Windows platform.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 13:37:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404417#M11762</guid>
      <dc:creator>santosh_sshanbh</dc:creator>
      <dc:date>2019-02-26T13:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to add validation for multiple parameters in custom alert action</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404418#M11763</link>
      <description>&lt;P&gt;Sorry I don't have Splunk on Windows so can't replicate this, it is worth to log support case with splunk.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 13:40:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-add-validation-for-multiple-parameters-in-custom-alert/m-p/404418#M11763</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-02-26T13:40:23Z</dc:date>
    </item>
  </channel>
</rss>

