This topic describes how to create content templates, set up Webhook integration, create notification groups, set alarm policies (including sending raw logs in alarm notifications), and view alarm records. These steps help you quickly get started with log alarm features in TLS.
TLS provides a one-stop alarm function for real-time monitoring and rapid response to alarm events. This example configures an alarm policy based on website error logs. That is to say, a dedicated log topic is created to store website error logs. In alarm policy, the * | SELECT COUNT(*) AS total statement is employed on counting the number of error logs. If the log topic contains more than 0 logs, it indicates an error has occurred and triggers the alarm condition $1.total>0. The alarm notification is then sent to the Lark bot immediately.
- The website error logs have been collected in TLS. For detailed steps, see Collection overview.
Step 1 Create a content template
A content template is a predefined text template. TLS sends alert notifications to designated notification channels based on the content defined in the template. TLS provides a default template for your convenience. This example creates a custom content template based on the default template.
- Select the region where log service is located from the top navigation bar.
- On the left navigation bar, select Common features > Log alarm > Notification management.
- On the Notification management page, under the Alarm template tab, click Create alarm template.
- Configure the content template settings.
- Name the template, for example, Lark content template.
- Set the notification content in the Lark section.
Step 2 Create a Webhook integration configuration
The Webhook integration configuration manages the Lark bot Webhook address.
- On the notification management page, click the webhook integration tab, and then click Create webhook integration.
- In the Create Webhook integration configuration dialog box, complete the following settings and click Create.
Step 3 Create a notification group
Notification groups manage action policy and notification recipients for alarm notifications.
- On the notification management page, select the notification group tab, and then click Create notification group.
- On the Create notification group page, complete the following configurations and click Create notification group.
-
Step 4 Create an alarm policy
In alarm policy, configurations like basic information, monitoring task, and alarm notification are required. TLS periodically analyzes logs based on the alarm policy and sends alarms that meet the trigger conditions to the specified notification recipients on a regular basis.
- In the left navigation panel, select Common features > Log alarm > Alarm policy.
- On the Alarm policy page, click Create alarm policy.
- On the Create alarm policy page, complete the following configuration.
- Fill in the Basic information for the alarm policy.
- Configure Monitoring task.
- Click Test alarm policy.
- To make it easier to troubleshoot problems in abnormal scenarios and preview alarm notification results in advance, we recommend that you debug using the alarm testing feature when creating an alarm policy. For detailed information about the alarm testing feature, see Alarm policy testing.
- Click Create alarm policy.
- After creating an alarm policy, the policy is enabled by default. TLS will continue to run monitoring tasks and send alarm notifications based on the alarm policy.
Step 5 View alarm records
After the alarm policy takes effect, monitoring tasks will run periodically and record the result of each execution.
- In the left navigation bar, select Common features > Log alarm > Alarm history.
- View alarm records on the Alarm history page.