Detection Alert Formatting
Custom formatting for detection alerts
Last updated
Was this helpful?
Custom formatting for detection alerts
Last updated
Was this helpful?
Detection alert formatting allows teams to customize the content in detection alerts that are sent to Slack and webhooks.
You can add custom formatting by going to the create/edit detection rule page and going to the Format Alert section. This feature is also support in Detections as Code, see Writing Detection Rules for more information.
In Information, you can add section headers and text for the alert body. In the example below, there is a section titled Description and the section text includes the description of the detection rule.
In Actions, you can add action names and URLs, such as a runbook link for the alert. Actions will appear as buttons in Slack and as links in Markdown.
The Preview button will allow you to view the formatting in Slack, Markdown, and JSON.
The @alert
object represents a detection alert and contains the following fields:
id
string
Unique identifier for the detection alert
detection_rule_id
string
Unique identifier for the detection rule that triggered the alert
tenant_id
string
Unique identifier for the tenant
severity_id
number
name
string
Name of the detection rule
description
string
Description of the detection rule
query_text
string
Query for the detection rule
detected_in_time_range.start
string
Start of the detection time range
detected_in_time_range.end
string
End of the detection time range
timestamp
string
The time the detection was triggered. Note that this can be outside of the detection time range.
tags[i]
string
The i-1
th tag for the detection rule, e.g. tags[0]
will return the first tag for the detection rule.
results_table.total_row_count
string
Total number of the results (hits) for the query
results_table.rows[i].<column>
string
The value of the given <column>
in the i-1
th row in the results table, e.g. results_table.rows[0].foo
will return the value of the foo
column from the first row of results. Detection events contain a maximum of 10 rows in the results table.
Fields from the @alert
object can be templated using double curly-braces {{
and }}
, for example, {{@alert.name}}
will template the name of the detection rule.
Templating can be combined with normal strings, e.g Name: {{@alert.name}}
.
Templating supports basic arithmetic: addition, subtraction, multiplication, divison, and negation. For example, {{@alert.results_table.total_row_count + 1}}
will add 1 to the total row count from the @alert
object. Arithmetic is only supported for number fields, templating arithmetic with string fields will result in an empty string.
Closing double-curly braces }}
are expected whenever there are open double curly-braces {{
, otherwise, the template will not parse.
The severity of the detection. See for more information.