Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.9] Backport query rule alert suppression to API docs (#4496) #4570

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions docs/detections/api/rules/rules-api-create.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,29 @@ must be an {es} date data type.

|==============================================

[[opt-fields-alert-suppression-create]]
===== Optional alert suppression fields for query rules

preview::[]

[width="100%",options="header"]
|==============================================
|Name |Type |Description

|alert_suppression |Object a|Defines alert suppression configuration. Available fields:

* `group_by` (string[], required): An array of 1-3 field names to use for suppressing alerts.

* `duration` (<<alert-suppression-duration-schema, duration object>>, optional): The time period in which alerts will be suppressed, beginning when the rule first meets its criteria and creates the alert. If not specified, alerts will be suppressed on rule execution only.

* `missing_fields_strategy` (string, optional): Defines how to handle events with missing suppression fields. Possible values:

- `doNotSuppress`: Create a separate alert for each matching event.

- `suppress`: Create one alert for each group of events with missing fields.

|==============================================

[[actions-object-schema]]
===== `actions` schema

Expand Down Expand Up @@ -691,6 +714,20 @@ All fields are required:
NOTE: Only threats described using the MITRE ATT&CK^TM^ framework are displayed
in the UI (*Manage* -> *Rules* -> *_Rule name_*).

[[alert-suppression-duration-schema]]
===== `alert_suppression.duration` schema

All fields are required:

[width="100%",options="header"]
|==============================================
|Name |Type |Description

|unit |string | Time unit. Possible values are: `s`(seconds), `m`(minutes), or `h`(hours).
|value |number | Positive number.

|==============================================

===== Example requests

*Example 1*
Expand Down Expand Up @@ -965,6 +1002,51 @@ POST api/detection_engine/rules
--------------------------------------------------
// KIBANA

*Example 7*

Query rule that searches for processes started by MS Office and suppresses alerts by the `process.parent.name` field within a 5-hour time period:

[source,console]
--------------------------------------------------
POST api/detection_engine/rules
{
"rule_id": "process_started_by_ms_office_program",
"risk_score": 50,
"description": "Process started by MS Office program - possible payload",
"interval": "1h",
"name": "MS Office child process",
"severity": "low",
"tags": [
"child process",
"ms office"
],
"type": "query",
"from": "now-70m",
"query": "process.parent.name:EXCEL.EXE or process.parent.name:MSPUB.EXE or process.parent.name:OUTLOOK.EXE or process.parent.name:POWERPNT.EXE or process.parent.name:VISIO.EXE or process.parent.name:WINWORD.EXE",
"language": "kuery",
"filters": [
{
"query": {
"match": {
"event.action": {
"query": "Process Create (rule: ProcessCreate)",
"type": "phrase"
}
}
}
}
],
"enabled": false,
"alert_suppression": {
"duration": { "unit": "h", "value": 5 },
"group_by": [
"process.parent.name"
],
"missing_fields_strategy": "suppress"
}
}
--------------------------------------------------

==== Response code

`200`::
Expand Down
25 changes: 25 additions & 0 deletions docs/detections/api/rules/rules-api-update.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,31 @@ technique:
NOTE: Only threats described using the MITRE ATT&CK^TM^ framework are displayed
in the UI (*Manage* -> *Rules* -> *_Rule name_*).


[[opt-fields-alert-suppression-update]]
===== Optional alert suppression fields for query rules

preview::[]

[width="100%",options="header"]
|==============================================
|Name |Type |Description

|alert_suppression |Object a|Defines alert suppression configuration. Available fields:

* `group_by` (string[], required): An array of 1-3 field names to use for suppressing alerts.

* `duration` (<<alert-suppression-duration-schema, duration object>>, optional): The time period in which alerts will be suppressed, beginning when the rule first meets its criteria and creates the alert. If not specified, alerts will be suppressed on rule execution only.

* `missing_fields_strategy` (string, optional): Defines how to handle events with missing suppression fields. Possible values:

- `doNotSuppress`: Create a separate alert for each matching event.

- `suppress`: Create one alert for each group of events with missing fields.

|==============================================


===== Example request

Updates the `threat` object:
Expand Down