Customize notification content
Simple Log Service lets you customize notification content when you configure a content template.
Enrich notification content with template variables
When you configure a content template, you can add template variables to the title or message. When Simple Log Service sends an alert notification, it replaces the template variables in the message and title with their actual values. For example, {{ alert.project }} is replaced with the actual project name.
Each time an alert is triggered, the system automatically generates alert context information and stores it in the Results field. The subfields in the Results field can be used as template variables. For more information, see Content template syntax (new version) and Content template variable reference (new version).
Comparison between new and old content templates
The new alerting feature supports two versions of content template syntax. The new version provides more flexible and advanced custom rendering logic than the old version.
Feature | New version | Old version |
Reference method |
|
|
Template variables | Content and style are separate. Alert variables provide the content, and you can use control flows and functions to format the content. For more information, see Content template variable reference (new version). | Content and style are combined. Alert variables provide both. For more information, see Content template variable reference (old version). |
Control flow (such as conditional judgment and iteration) | Supported. For more information, see Content template syntax (new version). | Not supported. |
Filter processing | Supported. For more information, see Built-in template functions. | Not supported. |
Content format
DingTalk
Content for the DingTalk channel supports the Markdown syntax. The following elements are supported. For more information, see DingTalk Open Platform - Custom Robot Access.
Title
# Level 1 title ## Level 2 title ### Level 3 title #### Level 4 title ##### Level 5 title ###### Level 6 titleQuote
> A man who stands for nothing will fall for anything.Bold and italic text
**bold** *italic*Link
[this is a link](http://example.com)Image
Unordered list
- item1 - item2Ordered list
1. item1 2. item2
WeCom
Content for the WeCom channel supports the Markdown syntax. The following elements are supported. For more information, see Group Robot Configuration.
ImportantIn WeCom messages,
\n\nis rendered as\n. Therefore, if you need a blank line, use\n\n\n.Title
# Title one ## Title two ### Title three #### Title four ##### Title five ###### Title sixBold
**bold**Link
[This is a link](http://work.weixin.qq.com/api/doc)Inline code segment
`code`Quote
> Quoted textFont color
Only three built-in colors are supported.
<font color="info">Green</font> <font color="comment">Gray</font> <font color="warning">Orange-red</font>
Lark
Content for the Lark channel supports the Markdown syntax. The following elements are supported. For more information, see Use Markdown tags.
Bold
**Bold**Italic
*Italic*Strikethrough
~~Strikethrough~~Hyperlink
<a>https://open.feishu.cn</a>Text link
[Developer document](https://open.feishu.cn)Image
Line separator
---
Slack
The Slack application supports Markdown for incoming webhooks, but only a subset of the syntax is available. For more information, see Slack Markdown Reference.
Webhook
The Webhook channel supports sending messages individually or in batches.
Content template:
{ "Project": "${project}", "Alert Name": "${alert_name}" }Content of a batched notification:
[ { "Project": "project-name1", "Alert Name": "alert-name1" }, { "Project": "project-name2", "Alert Name": "alert-name2" } ]
Email
The email channel supports HTML tags. For more information, see HTML. For example:
Use
<br>for a line break.Use
<a href="${query_url}">View details</a>to add a link to the details of the triggered alert.Use
${severity}to display the alert severity in bold.