Updated on 2022-06-09 GMT+08:00

Building a Program

This section describes how to download and use the program package (index.zip) for log alarms.

Creating a Function

Create a function for extracting logs and upload the sample code package, as shown in Figure 1. For details, see Function Management.

Figure 1 Creating a function

This function analyzes received operation records, filters logins or logouts from unauthorized IP addresses using a whitelist, and sends alarms under a specified SMN topic.

Setting Environment Variables

On the Configuration tab page of the function, set the environment variables and SMN topic name, as shown in Table 1.

Table 1 Environment variable description

Environment Variable

Description

SMN_Topic

SMN topic name.

RegionName

Region.

IP

IP address whitelist.

For details about how to set environment variables, see Using Environment Variables, as shown in Figure 2.

Figure 2 Setting environment variables