Create exceptions for a rule
editCreate exceptions for a rule
editAdds specified exception items to a rule’s default exception list. A default exception list contains exceptions that are associated with a single rule, as opposed to a shared exception list, which contains exceptions that are associated with multiple rules.
If a default exception list doesn’t exist for a rule, one is automatically created when you try to add an exception to it.
For more information about creating exceptions that are used by multiple rules, refer to Create exceptions used by multiple rules. For more information about creating exception items from a list, such as a list of IP addresses or hosts names, refer to Lists API.
Request URL
editPOST <kibana host>:<port>/api/detection_engine/rules/<id>/exceptions
Allows you to create exception items that are associated with a specified rule id
.
URL query parameters
editName | Type | Description | Required |
---|---|---|---|
|
String |
Specify the rule ID. |
Yes. |
Request body
editA JSON object with an array of exception items, where each exception item has the required fields.
Name | Type | Description | Required |
---|---|---|---|
|
String[] |
Specify an array of exception list items to create. |
Yes |
|
Object[] |
Array of
|
No |
|
String |
Describes the exception item. |
Yes |
|
Array containing the
exception queries. Boolean |
Yes |
|
|
String |
The exception item’s expiration date, in ISO format. This field is only available for regular exception items, not endpoint exceptions. |
No |
|
String |
ID of the associated exception container. |
Yes |
|
String |
Unique identifier of the exception item. |
No, automatically created when it is not provided. |
|
Object |
Placeholder for metadata about the exception item. |
No |
|
String |
The exception item’s name. |
Yes |
|
String |
Determines whether the exception item is available in all Kibana spaces or just the space in which it is created, where:
Must be the same value as its associated exception container. Default value is |
No |
|
String[] |
Defines the OS on which the exception is implemented. Valid values are:
Default value is |
No |
|
String[] |
String array containing words and phrases to help categorize exception items. |
No |
|
String |
Exception query type, must be |
Yes |
entries
schema
editName | Type | Description | Required |
---|---|---|---|
|
String |
The source event field used to define the exception. Cannot be an empty string. |
Yes |
|
String |
The operator used to determine when the exception is used. Can be:
|
Yes |
|
String |
The
|
Yes |
|
String String[] |
Field value or values:
|
Yes, except when |
When you use list containers
("type": "list"
), you cannot use other types in the entries
array (match
,
match_any
, exists
, or nested
).
For endpoint exceptions, you cannot create exception items based on excluded
values ("operator": "excluded"
).
Example requests
editPOST api/detection_engine/rules/<id>/exceptions { "items": [ { "description": "Excludes the weekly maintenance job", "entries": [ { "field": "process.name", "operator": "included", "type": "match", "value": "maintenance-job" } ], "name": "Linux maintenance job", "tags": [ "in-house processes", "linux" ], "type": "simple" } ] }
Response code
edit-
200
- Indicates a successful call.
Response payload
editThe returned exception item.
Example response:
{ "body": [ { "comments": [], "created_by": "elastic", "description": "Exception item for rule default exception list", "entries": [ { "field": "host.name", "operator": "included", "type": "match", "value": "foo", }, ], "name": "Sample exception item", "list_id": "e6c44050-c661-11ea-bab5-9d6ae015701b", "namespace_type": "single", "os_types": [], "tags": [], "type": "simple", "updated_by": "elastic" } ] }