Building a Program

You can download and use the alarm log analysis program package provided in this example.

Creating a Function

Create a function by uploading the sample code package to analyze logs, as shown in Figure 1. For details, see Creating a Function.
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. This function can be used to build an account security monitoring service.

Setting Environment Variables

On the Configuration tab page of the function details page, set the environment variables listed in Table 1.

Table 1 Environment variables

Environment Variable

Description

SMN_Topic

SMN topic.

RegionName

Region name.

IP

IP address whitelist.

Set the environment variables (Figure 2) by following the procedure in Environment Variables.
Figure 2 Setting environment variables