Simple Log Service sends alert notifications based on the content that is specified in alert templates.
Procedure
Log on to the Log Service console.
Go to the Alert Template page.
In the Projects section, click the project that you want to manage.
In the left navigation sidebar, click Alerts.
On the Alert Center page, choose .
Create an alert template.
Click Create.
Specify an ID and a name for the alert template.
Configure the content for each notification method.
You can set parameters for the following notification methods in an alert template: SMS, Voice, Email, DingTalk, WebHook-Custom, Notifications, Enterprise WeChat, Lark, and Slack.
Tab
Parameter
SMS
You can set the following parameters:
Language: the language of an alert notification. Valid values: Chinese and English.
Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
Voice
You can set the following parameters:
Language: the language of an alert notification. Valid values: Chinese and English.
Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
Email
You can set the following parameters:
Language: the language of an alert notification. Valid values: Chinese and English.
Subject: the subject of an alert notification. You can enter a subject or use template variables to specify the subject of an alert notification.
Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
DingTalk
You can set the following parameters:
Title: the title of an alert notification. You can enter a title or use template variables to specify the title of an alert notification.
Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
Webhook-Custom
You can set the following parameters:
Sending Mode: the method by which alert notifications are sent. Valid values: Single and Batch.
For example, you add the following template variables to the Content parameter:
{ "project": "{{project}}", "alert_name": "{{alert_name}}"}
. If two alerts are triggered, two alert notifications are sent by using one of the following methods:Single: Simple Log Service sends the two alert notifications in sequence. Content:
{ "project": "project-1", "alert_name": "alert-1"}
and{ "project": "project-2", "alert_name": "alert-2"}
.Batch: Simple Log Service sends one message that includes the two alert notifications. Content:
[{ "project": "project-1", "alert_name": "alert-1"}, { "project": "project-2", "alert_name": "alert-2"}]
.If you select Batch and set the Maximum number of items sent in a group parameter to N, an alert notification for the first N alerts in a merged set is sent.
If you select Batch and the content that you specify can be parsed into JSON data, an alert notification is sent in the JSON format. If the content cannot be parsed into JSON data, an alert notification is sent as an array that contains strings.
Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
NoteWhen Simple Log Service sends alert notifications, the request header Content-Type: application/json;charset=utf-8 is used by default. If a webhook receiver requires a request header in a different format, you can customize the request header when you configure the notification method. For more information, see Webhook-Custom.
Notifications
You can set the following parameters:
Language: the language of an alert notification. Valid values: Chinese and English.
Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
Enterprise WeChat
You can set the following parameters:
Title: the title of an alert notification. You can enter a title or use template variables to specify the title of an alert notification.
Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
Lark
You can set the following parameters:
Title: the title of an alert notification. You can enter a title or use template variables to specify the title of an alert notification.
Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
Slack
You can set the following parameters:
Title: the title of an alert notification. You can enter a title or use template variables to specify the title of an alert notification.
Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
EventBridge
You can set the following parameters:
Subject: the subject of an alert notification. You can enter a subject or use template variables to specify the subject of an alert notification.
Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
Function Compute
You can set the following parameters:
Sending Mode: the method by which alert notifications are sent. Valid values: Single and Batch.
For example, you add the following template variables to the Content parameter:
{ "project": "{{project}}", "alert_name": "{{alert_name}}"}
. If two alerts are triggered, two alert notifications are sent by using one of the following methods:Single: Simple Log Service sends the two alert notifications in sequence. Content:
{ "project": "project-1", "alert_name": "alert-1"}
and{ "project": "project-2", "alert_name": "alert-2"}
.Batch: Simple Log Service sends one message that includes the two alert notifications. Content:
[{ "project": "project-1", "alert_name": "alert-1"}, { "project": "project-2", "alert_name": "alert-2"}]
.If you select Batch and set the Maximum number of items sent in a group parameter to N, an alert notification for the first N alerts in a merged set is sent.
If you select Batch and the content that you specify can be parsed into JSON data, an alert notification is sent in the JSON format. If the content cannot be parsed into JSON data, an alert notification is sent as an array that contains strings.
Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
Click OK.