Detection Rules
A detection rule is a query that runs continuously on new logs as they arrive in Scanner. You can create create, read, update, and delete detection rules with the Scanner API.
Create a new detection rule
POST
/v1/detection_rule
Create a new detection rule with the specified data.
If the detection rule is active, it will be immediately scheduled for backfill and execution.
Body
Name | Type | Description |
---|---|---|
| string | Unique identifier for the tenant |
| string | Name of the detection rule |
| string | Description of the detection rule |
| Lookback period (in seconds) | |
| How frequently to run the detection rule (in seconds) | |
| boolean | Whether the detection rule is enabled |
| The severity of the detection | |
| string | Query for the detection rule |
| list of strings | Event sinks to send event alerts to |
| string | Sync key, used by automatic detection rule syncers |
Example
Response
Returns the newly created detection rule.
List detection rules
GET
/v1/detection_rule
List all detection rules for a tenant.
Query parameters
Name | Type | Description |
---|---|---|
| string | Unique identifier for the tenant |
Example
Response
Returns a list of detection rule summaries. The detection rule summary object is the same as the detection rule object, but it does not include event_sink_ids
.
Get a detection rule
GET
/v1/detection_rule/{id}
Get the detection rule with the given id.
Example
Response
Returns the detection rule.
Update a detection rule
PUT
/v1/detection_rule/{id}
Update the detection rule with the given id.
Body
Name | Type | Description |
---|---|---|
| string | Unique identifier for the detection rule |
| string | Update the name of the detection rule |
| string | Update the description of the detection rule |
| Update the lookback period of the detection rule | |
| Update the how frequently the detection rule is run | |
| boolean | Enable or disable the detection rule |
| Update the severity of the detection rule | |
| string | Update the query for the detection rule |
| list of strings | Update the event sinks for the detection rule |
| string | Update the sync key for the detection rule |
Example
Response
Returns the updated detection rule.
Delete a detection rule
DELETE
/v1/detection_rule/{id}
Delete the detection rule with the given id.
Example
Response
Returns the id
and tenant_id
for the deleted detection rule.
Time range and run frequency
time_range_s
is the lookback period for the detection rule and run_frequency_s
is how often the detection rule is run. Valid values for time_range_s
and run_frequency_s
are:
60 (1 minute)
300 (5 minutes)
900 (15 minutes)
3600 (1 hour)
21600 (6 hours)
86400 (24 hours)
run_frequency_s
is at most two levels below time_range_s
. For example, if time_range_s
is 300, valid values for run_frequency_s
are 60, 300, and 900.
Detection severity
We use the OCSF schema for detection severity:
Unknown
Information
Low
Medium
High
Critical
Fatal
Other
The detection severity must be one of these string values, e.g.
Last updated