Updated on 2023-12-15 GMT+08:00

Building a Program

Download index.zip to create an alarm log analysis function from scratch.

Creating a Function

Create a function by uploading the sample code package to extract logs. Select the Python 2.7 runtime and the agency serverless_trust created in Creating an Agency. For details about how to create a function, see Creating an Event 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 by following the procedure in Environment Variables.