Simple Log Service sends alert notifications based on the content that is specified in alert templates.
Procedure
Log on to the Simple Log Service console.
Go to the Alert Template tab.
In the Projects section, click a project.
In the left-side navigation pane, click Alerts.
On the Alert Center page, choose
.
On the Alert Template tab, click Create.
In the Add Alert Template dialog box, configure the parameters and click Confirm. The following table describes the parameters.
You can configure parameters for the following notification methods in an alert template: SMS, Voice, Email, DingTalk, WebHook-Custom, Notifications, WeCom, Lark, and Slack.
Parameter
Description
ID
The ID of the alert template. The ID must be unique within an Alibaba Cloud account.
Name
The name of the alert template.
SMS
You can configure the following parameters:
Language: the language of an alert notification. Valid values: Chinese and English.
Content: the content of an alert notification. You can 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 configure the following parameters:
Language: the language of an alert notification. Valid values: Chinese and English.
Content: the content of an alert notification. You can 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 configure 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 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 configure 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 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 configure the following parameters:
Sending Mode: the method that is used to send alert notifications. Valid values: Single and Batch.
For example, you enter
{ "project": "{{project}}", "alert_name": "{{alert_name}}"}
in the Content field, and two alerts are triggered.Single: Two alert notifications are separately sent. The content is
{ "project": "project-1", "alert_name": "alert-1"}
and{ "project": "project-2", "alert_name": "alert-2"}
.Batch: Two alert notifications are sent at a time. The content is
[{ "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 merge 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 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 specify a custom request header when you configure the notification method. For more information, see Webhook-Custom.
Notifications
You can configure the following parameters:
Language: the language of an alert notification. Valid values: Chinese and English.
Content: the content of an alert notification. You can enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
WeCom
You can configure 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 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 configure 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 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 configure 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 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 configure 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 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 configure the following parameters:
Sending Mode: the method that is used to send alert notifications. Valid values: Single and Batch.
For example, you enter
{ "project": "{{project}}", "alert_name": "{{alert_name}}"}
in the Content field, and two alerts are triggered.Single: Two alert notifications are separately sent. The content is
{ "project": "project-1", "alert_name": "alert-1"}
and{ "project": "project-2", "alert_name": "alert-2"}
.Batch: Two alert notifications are sent at a time. The content is
[{ "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 merge 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 enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.