Alibaba Cloud SLS integration

Updated at:

This topic describes how to integrate an Alibaba Cloud Simple Log Service (SLS) monitoring source.

Introduction

Alibaba Cloud Simple Log Service (SLS) is a cloud-native observability platform from Alibaba Cloud. It provides large-scale, low-cost, and real-time services for data such as logs, metrics, and traces. You can integrate the O&M Event Center with SLS to manage alerts and events in a unified manner. Follow the steps in this topic to connect your alert records.

Integrate with SLS

Step 1: Find the SLS monitoring source

Go to the O&M Event Center. In the navigation pane on the left, choose Integration Center > Integration Configuration. Find and click SLS Monitoring Source to open the page for adding a new integration. Follow the on-screen instructions to complete the setup.

Step 2: Add a content template

  1. Click Alibaba Cloud SLS to go to the SLS console. In the Project list, click the project that you want to use.

  2. In the navigation pane on the left, choose Alerts > Notification Policies > Content Templates.

  3. Click Create. The Add Content Template dialog box appears.

  4. In the dialog box, enter an Identifier and a Name. Set Template Type to webhook-Custom and Send Method to Send one by one.

  1. Copy the following code block and paste it into the Send Content box. Then, click Confirm.

{
  "aliuid":"${aliuid}",
  "alert_instance_id":"${alert_instance_id}",
  "alert_id":"${alert_id}",
  "alert_name":"${alert_name}",
  "region":"${region}",
  "project":"${project}",
  "alert_time":"${alert_time}",
  "alert_url":"${alert_url}",
  "query_url":"${query_url}",
  "fire_time":"${fire_time}",
  "resolve_time":"${resolve_time}",
  "status":"${status}",
  "fire_results_count":"${fire_results_count}",
  "fire_results_as_kv":"${fire_results_as_kv}",
  "labels":"${labels}",
  "annotations_title":"${annotations.title}",
  "annotations_desc":"${annotations.desc}",
  "severity":"${severity}",
  "logstore":"${results[0].store}",
  "fire_results":"${results[0].fire_results}"
}

Step 3: Add an action policy

  1. Click Alibaba Cloud SLS to go to the SLS console. In the Project list, click the project that you want to use.

  2. In the navigation pane on the left, choose Alerts > Notification Policies > Action Policies.

  3. Click Create. Right-click Start and select Add Action Group.

  1. Set Channel to webhook-Custom. In the Request URL field, enter the following URL.

https://public-alert.aliyuncs.com/event/aliyun/sls/{integration_key}
Note

The integration key in the URL is the key for the SLS monitoring source, which you can obtain from the O&M Event Center.

  1. Set Request Method to POST. Add a Request Header with the key `Content-Type` and value `application/json`. Select the content template that you created in Step 2 and click Confirm.

Step 4: Create an alert rule

  1. Click Alibaba Cloud SLS to go to the SLS console. In the Project list, click the project that you want to use.

  2. In the navigation pane on the left, choose Alerts > Alert Rules > Create Alert.

  3. Complete the configurations as prompted on the page. For more information about how to create an alert, see Quickly create a log-based alert.

  4. Set Output Target to SLS Notification and click the Enable button on the right.

  5. Set Alert Policy to Normal Mode. For Action Policy, select the action policy that you configured in Step 3. Click OK.

Note

In the Action Policy field, you can enter the name of the action policy that you created to automatically retrieve it.

Step 5: Confirm the integration

After you complete the preceding steps, return to the SLS integration page in the O&M Event Center. Click the Confirm Integration button below the integration key to complete the configuration.

Step 6: Authenticate

In SLS, configure alerting, set subscription rules, and trigger an alert. The integration is successful if the alert status of the SLS monitoring source on the Integration Configuration page changes to Accepted.