Spaces method and path for this operation:
Refer to Spaces for more information.
Body
-
Default value is
[](empty). -
Indicates that an alert occurs only when the specified number of consecutive runs met the rule conditions.
Additional properties are NOT allowed.
-
Additional properties are NOT allowed.
-
When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced.
Additional properties are NOT allowed.
-
The name of the rule. While this name does not have to be unique, a distinctive name can help you identify a rule.
-
Indicates how frequently rule actions are triggered. Valid values include:
onActionGroupChange: Actions run when the alert status changes;onActiveAlert: Actions run when the alert becomes active and at each check interval while the rule conditions are met;onThrottleInterval: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met. You cannot specifynotify_whenat both the rule and action level. The recommended approach is to set it for each action individually. If you setnotify_whenat the rule level and then edit the rule, it will automatically be converted to action-specific values.Values are
onActionGroupChange,onActiveAlert, oronThrottleInterval. -
The parameters for the rule.
Default value is
{}(empty). -
Additional properties are NOT allowed.
-
Use the
throttleproperty in the actionfrequencyobject instead. The throttle interval, which defines how frequently rule actions are triggered. You cannot specify the throttle interval at both the rule and action level. If you set the throttle interval at the rule level and then edit the rule, it will automatically be converted to action-specific values.
curl \
--request PUT 'https://localhost:5601/api/alerting/rule/{id}' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--header "kbn-xsrf: true" \
--data '{"actions":[{"frequency":{"notify_when":"onActionGroupChange","summary":false},"group":"threshold met","id":"96b668d0-a1b6-11ed-afdf-d39a49596974","params":{"level":"info","message":"Rule {{rule.name}} is active for group {{context.group}}:\n\n- Value: {{context.value}}\n- Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}}\n- Timestamp: {{context.date}}"}}],"name":"new name","params":{"aggField":"sheet.version","aggType":"avg","groupBy":"top","index":[".updated-index"],"termField":"name.keyword","termSize":6,"threshold":[1000],"thresholdComparator":"\u003e","timeField":"@timestamp","timeWindowSize":5,"timeWindowUnit":"m"},"schedule":{"interval":"1m"},"tags":[]}'
{
"actions": [
{
"frequency": {
"notify_when": "onActionGroupChange",
"summary": false
},
"group": "threshold met",
"id": "96b668d0-a1b6-11ed-afdf-d39a49596974",
"params": {
"level": "info",
"message": "Rule {{rule.name}} is active for group {{context.group}}:\n\n- Value: {{context.value}}\n- Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}}\n- Timestamp: {{context.date}}"
}
}
],
"name": "new name",
"params": {
"aggField": "sheet.version",
"aggType": "avg",
"groupBy": "top",
"index": [
".updated-index"
],
"termField": "name.keyword",
"termSize": 6,
"threshold": [
1000
],
"thresholdComparator": ">",
"timeField": "@timestamp",
"timeWindowSize": 5,
"timeWindowUnit": "m"
},
"schedule": {
"interval": "1m"
},
"tags": []
}
{
"actions": [
{
"connector_type_id": ".server-log",
"frequency": {
"notify_when": "onActionGroupChange",
"summary": false,
"throttle": null
},
"group": "threshold met",
"id": "96b668d0-a1b6-11ed-afdf-d39a49596974",
"params": {
"level": "info",
"message": "Rule {{rule.name}} is active for group {{context.group}}:\n\n- Value: {{context.value}}\n- Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}}\n- Timestamp: {{context.date}"
},
"uuid": "07aef2a0-9eed-4ef9-94ec-39ba58eb609d"
}
],
"api_key_created_by_user": false,
"api_key_owner": "elastic",
"consumer": "alerts",
"created_at": "2024-03-26T23:13:20.985Z",
"created_by": "elastic",
"enabled": true,
"execution_status": {
"last_duration": 52,
"last_execution_date": "2024-03-26T23:22:51.390Z",
"status": "ok"
},
"id": "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74",
"last_run": {
"alerts_count": {
"active": 0,
"ignored": 0,
"new": 0,
"recovered": 0
},
"outcome": "succeeded",
"outcome_msg": null,
"warning": null
},
"mute_all": false,
"muted_alert_ids": [],
"name": "new name",
"next_run": "2024-03-26T23:23:51.316Z",
"params": {
"aggField": "sheet.version",
"aggType": "avg",
"groupBy": "top",
"index": [
".updated-index"
],
"termField": "name.keyword",
"termSize": 6,
"threshold": [
1000
],
"thresholdComparator": ">",
"timeField": "@timestamp",
"timeWindowSize": 5,
"timeWindowUnit": "m"
},
"revision": 1,
"rule_type_id": ".index-threshold",
"running": false,
"schedule": {
"interval": "1m"
},
"scheduled_task_id": "4c5eda00-e74f-11ec-b72f-5b18752ff9ea",
"tags": [],
"throttle": null,
"updated_at": "2024-03-26T23:22:59.949Z",
"updated_by": "elastic"
}