After you collect logs to a Logstore, you can add an alert rule to monitor them. This topic uses a DingTalk notification example to demonstrate how to set up log alerts.
Procedure
This example shows how to send alert notifications to a DingTalk group. After logs are collected to a Logstore, an alert rule checks the Logstore for data every 15 minutes. If data exists, an alert is triggered, and a DingTalk chatbot sends a notification. The process involves these steps:
-
Configure a notification recipient: Create a user named
Boband add this user to a user group. -
Configure an alert rule: Set up a rule to check the target Logstore for data every 15 minutes. An alert is triggered if data exists.
-
Configure a notification policy: Use the SLS built-in alert template to send a notification to a DingTalk group and notify
Bob.
Before you begin
Before you create an alert, make sure that logs are successfully collected to your Logstore.
Log on to the Simple Log Service console.
In the Projects section, click the one you want.

-
Click the
icon, select the target Logstore from the list, and then click Search & Analyze to confirm you can view your logs.
1. Configure notification recipients
You use users and user groups to specify notification recipients for alerts.
1.1 Create a user
In the left-side navigation pane, click Alerts. On the Alert Center page, create a user named Bob as shown in the following figure, and then click OK.

1.2 Create a user group
As shown in the following figure, add the user Bob to the test user group in the Add User Group dialog box, and then click OK.

2. Configure an alert rule
Alert rules monitor your log data. In this example, you configure an alert rule to check a target Logstore for data every 15 minutes. If data is found, a notification is sent to a DingTalk group.
2.1 Add query statistics
-
In the Alert Center, click the tab, and then click Create Alert.

-
In the Create Alert panel, configure the Query Statistics section and click Add.

-
In the Query Statistics dialog box, select the target Logstore, click Preview to view the data, and click OK.

2.2 Configure the trigger condition
In the Create Alert panel, set Trigger Condition to Data is returned and Severity to Medium. Then, click OK.

3. Configure a notification policy
3.1 Configure an alert template
Simple Log Service uses an alert template to define the content of notifications. For example, you can use the SLS built-in alert template to send alerts through DingTalk.
-
In the Alert Center, navigate to . Find the SLS built-in alert template and click Edit in the Actions column.

-
Configure the Content for DingTalk alerts, as shown in the following figure.

3.2 Configure SLS notification
Simple Log Service sends alerts to the Destination you select. For example, you can use SLS Notification to configure the DingTalk channel.
-
Prerequisites
To send alert notifications by using DingTalk, you must first create and configure a chatbot:
-
.
-
Open the DingTalk client, go to the DingTalk group, and click the settings icon in the upper-right corner.
-
Choose .
-
Select Custom (Custom message services via Webhook), click Add, and configure the chatbot: set a Chatbot name, for Security Settings, select Custom Keywords, enter alert, and then click Finished.
-
On the chatbot management page in the group chat, find the chatbot that you created and copy its webhook URL.
-
-
Create a webhook
In the Create Webhook dialog box, paste the copied webhook URL into the Request URL field. Configure the other parameters as shown in the following figure, and then click OK.

-
Configure the notification channel
On the Alert Rules tab, find the target rule and click Edit.

In the Edit Alert panel, configure the parameters as shown in the following figure, and then click OK.

View alert trigger records
View the alert dashboards
Go to to view the alert trigger count.

View notification details
-
On the , click the target rule.

-
You can view the detailed alert information. The alert was triggered successfully if Trigger Alert is true.

Related topics
-
For more information about notification channels for log alerts, see Notification methods.
-
You are charged only for SMS and voice notifications. For more information, see Billing.
-
For a description of alert attributes, see Alert attributes.
-
For more information about variables in alert templates, see Variables in alert templates (new version). To learn how to create an alert template, see Create an alert template.