All Products
Search
Document Center

:Create custom alert monitoring rule templates

Last Updated:Aug 29, 2023

Simple Log Service provides the template conversion feature. You can use this feature to convert a custom alert monitoring rule to a template. Then, you can reference the template across regions. This topic describes how to create a custom alert monitoring rule template.

Prerequisites

An alert monitoring rule is created. For more information, see Create an alert monitoring rule for logs.

Background information

In this example, your business data of the same category is written to Logstores that belong to different projects. If you want to use one alert monitoring rule to monitor all data, you can convert the rule to a template and associate the template with the required resources. When you use a custom alert monitoring rule template, make sure that the template meets your monitoring requirements for the same category of business data.

If you want to only copy an alert monitoring rule to other resources, you can use the rule copy feature. The following table describes the benefits and scenarios of the template conversion feature and the rule copy feature.

Note

The resources that are described in this topic refer to Simple Log Service projects, Logstores, and Metricstores.

Feature

Benefit

Scenario

Template conversion

  • Simple Log Service allows you to associate an alert monitoring rule template with resources across projects.

  • If you update an alert monitoring rule template, the update is valid for all resources that are associated with the template.

  • You can view all resources that are associated with the same alert monitoring rule template.

  • You can delete all alerts that are triggered by the same alert monitoring rule template at a time.

You can use one alert monitoring rule to monitor multiple resources. If you modify this rule, the modification is valid for all associated resources.

Rule copy

  • Simple Log Service allows you to copy an alert monitoring rule across projects.

  • If you delete or update an alert monitoring rule, the operation does not affect other alert monitoring rules.

After you copy an alert monitoring rule to another resource, you can configure the rule for the resource without affecting the original rule.

Limits

  • You can add only one query statement to an alert monitoring rule template. If you want to convert an alert monitoring rule to a template, you can specify only one query statement when you create or modify the rule. Otherwise, errors may occur when you convert the rule or save the template.

  • When you create alert monitoring rule templates, you may need to perform operations across projects. If you are using a RAM user, make sure that the RAM user is granted the required permissions to manage alerts for the required projects.

Procedure

  1. Log on to the Log Service console.

  2. Go to the Alert Rules/Incidents tab.

    1. In the Projects section, click the project that you want to manage.

    2. In the left navigation sidebar, click Alerts.

  3. On the Alert Rules/Incidents tab, find the alert monitoring rule that you want to manage and click Convert to Template in the Actions column.

  4. In the Add Simple Log Service Resource dialog box, select the required resources and click OK.

    After you configure the settings, the custom alert monitoring rule is converted to an alert monitoring rule template. The template is synchronized to the selected projects to monitor the selected Logstores or Metricstores. Alert monitoring rule template

    Important
    • If all selected resources fail to be associated with the alert monitoring rule during conversion, no alert monitoring rule template is generated and the original alert monitoring rule is retained.

    • If some selected resources fail to be associated with the alert monitoring rule during conversion, an alert monitoring rule template is generated and the original alert monitoring rule is deleted. The custom alert monitoring rule template is used to monitor only the resources that are associated with the rule.

Related operations

Associate resources with an alert monitoring rule template

When you associate resources with an alert monitoring rule template, you can add resources that you want to monitor or remove monitored resources.

  1. On the Alert Rules/Incidents tab, find the alert monitoring rule template that you want to manage and click Associate Resource in the Actions column.

  2. In the Add Simple Log Service Resource dialog box, select the required resources and click OK.

    After you associate resources with the template, click View in the Add Simple Log Service Resource dialog box to view the selected resources.

    Important

    When you associate resources with an alert monitoring rule template, you can add or remove resources. If all newly added resources fail to be associated with the template, you cannot remove any existing resources. This ensures that at least one resource is associated with the template.

Modify a template

  1. On the Alert Rules/Incidents tab, find the alert monitoring rule template that you want to modify and click Edit in the Actions column.

  2. In the Alert Rule panel, modify the settings of the alert monitoring rule template.

Delete a template

  1. On the Alert Rules/Incidents tab, find the alert monitoring rule template that you want to delete and click Delete Template in the Actions column.

  2. In the message that appears, click OK.

    Important
    • After you delete a template, all alert monitoring rules that are associated with the template are synchronously deleted and cannot be restored. Proceed with caution.

    • When you delete a template, the system removes the resources that are associated with the template. If some resources fail to be removed, the custom alert monitoring rule templates in the resources are not deleted.