Simple Log Service allows you to customize the content in alert notifications when you configure an alert template.
Available variables
When you configure an alert template, you can add variables to the title and body of the sample notification in the alert template. Before Simple Log Service pushes an alert notification, Simple Log Service replaces the variables with the actual values of the variables. For example, Simple Log Service replaces the {{ alert.project }}
variable with the name of the project in which the alert is triggered.
Every time an alert is triggered, Simple Log Service generates a context for the alert and stores the context in the Results field. All fields in the Results field can be referenced as variables in the alert template. For more information, see Syntax for new alert templates and Variables in new alert templates.
Comparison of alert templates between the original and new alerting features
The new alerting feature supports both the syntax that is provided by the new alerting feature and the syntax that is provided by the original alerting feature. Compared with the syntax provided by the original alerting feature, the syntax provided by the new alerting feature supports more flexible, advanced custom rendering logic.
Functionality | New alerting feature | Original alerting feature |
Functionality | New alerting feature | Original alerting feature |
Reference methods | General fields: {{ alert.project }} Nested fields: {{ alert.policy.alert_policy_id }} Array elements: {{ alert.results[0] }} Array element fields: {{ alert.results[0].query }}
| General fields: ${project} Nested fields: ${policy.alert_policy_id} Array elements: ${results[0]} Array element fields: ${results[0].query}
|
Template variables | The content is separated from the style. Variables provide the content. Control flows and functions are used to implement diverse styles. For more information, see Variables in new alert templates. | The content is not separated from the style. Both the content and the style are provided by variables. For more information, see Variables in original alert templates. |
Control flows such as conditions and iterations | Control flows are supported. For more information, see Syntax for new alert templates. | Control flows are not supported. |
Filter processing | Filter processing is supported. For more information, see Built-in functions in alert templates. | Filter processing is not supported. |
Content formatting
DingTalk
Alert notifications over DingTalk support the Markdown syntax. The following elements are available:
Heading
# Level 1 heading
## Level 2 heading
### Level 3 heading
#### Level 4 heading
##### Level 5 heading
###### Level 6 heading
Reference
> A man who stands for nothing will fall for anything.
Bold and italic text
Link
[this is a link](http://example.com)
Image

Unordered list
Ordered list
Enterprise WeChat
Alert notifications over Enterprise WeChat support the Markdown syntax. The following elements are available:
Important
In alert notifications that are pushed over Enterprise WeChat, \n\n
is rendered as \n
. If you want to add a blank line between the lines in an alert notification, you must use \n\n\n
.
Lark
Alert notifications over Lark support the Markdown syntax. The following elements are available:
Bold text
Italic text
Strikethrough text
Hyperlink
<a>https://open.feishu.cn</a>
Text link
[Development documentation](https://open.feishu.cn)
Image
Separator line
Slack
Incoming webhooks in Slack support only a part of the Markdown syntax. For more information, see Slack Markdown Reference.
Webhook
Webhooks can be used to push one or more alert notifications at a time.
Email
Emails support HTML tags. For more information, see HTML. Examples: