Create an action policy
- Base URL
-
https://{kibana_url}
- POST /api/alerting/v2/action_policies
- POST /s/{space_id}/api/alerting/v2/action_policies
Refer to Spaces for more information.
Creates an action policy with a server-generated identifier. To create or replace an action policy with a client-supplied identifier, use PUT /api/alerting/v2/action_policies/{id}/.
Required authorization
- Privileges manage_alerting-v2-action-policies and read_alerting-v2-rules
Request body
-
descriptionstring · min length: 1 · max length: 1024 -
A description of the action policy. Absent when the policy has none; send
nullon PATCH to clear it. -
destinationsoneOf · min items: 1 · max items: 10required -
The list of destinations. At least one is required.
-
matcherobject -
Selects the alerts this policy applies to. Set
tagsto match alerts from rules with those routing tags. Setexpressionto a KQL query, which will be evaluated against each alert.
If you set bothtagsandexpression, an alert must match the tags and the expression for the policy to apply. At least one oftagsandexpressionmust be set, so an emptymatcheris rejected. Omitmatcherentirely for a catch-all policy that applies to all alerts. -
expressionstring · min length: 1 · max length: 4096 -
A KQL query that's evaluated against each alert. Supported fields are:
alert_id,alert_status,group_hash,last_event_timestamp,severity, and your rule's query output columns underdata.*(for example,data.host.name). Referencing other fields won't work. Omitmatcher.expressionto match ontagsalone. -
Routing tags this policy should match. The policy applies to alerts from any rule whose
metadata.routing_tagsinclude at least one of these tags. An empty array is not accepted. Omitmatcher.tagsto match onmatcher.expressionalone.
Responses
Returns the newly created action policy.
-
matcherobject -
Selects the alerts this policy applies to. Set
tagsto match alerts from rules with those routing tags. Setexpressionto a KQL query, which will be evaluated against each alert.
If you set bothtagsandexpression, an alert must match the tags and the expression for the policy to apply. At least one oftagsandexpressionmust be set, so an emptymatcheris rejected. Omitmatcherentirely for a catch-all policy that applies to all alerts. -
expressionstring · min length: 1 · max length: 4096 -
A KQL query that's evaluated against each alert. Supported fields are:
alert_id,alert_status,group_hash,last_event_timestamp,severity, and your rule's query output columns underdata.*(for example,data.host.name). Referencing other fields won't work. Omitmatcher.expressionto match ontagsalone. -
Routing tags this policy should match. The policy applies to alerts from any rule whose
metadata.routing_tagsinclude at least one of these tags. An empty array is not accepted. Omitmatcher.tagsto match onmatcher.expressionalone. -
snoozed_untilstring -
The ISO datetime until which the policy is snoozed. Omitted when the policy is not snoozed.
Indicates an invalid schema or parameters.
Indicates the request was not authenticated.
Indicates the user does not have the required privileges, or the current license does not support action policies. Creating, updating, and enabling action policies requires an active Enterprise license.
Indicates an unexpected server-side error.
Indicates the alerting engine is disabled by the alerting:v2:enabled advanced setting.