Use Huawei Cloud FunctionGraph to collect log data from Huawei Cloud LTS and OBS, and forward it to the observability platform logs.
-
Open the FunctionGraph console and go to the Functions page.
-
Click Create Function.
-
Select Event Function.
-
Enter the Function Name.
-
Set Runtime to Python 3.9.
-
In the Agency Name setting, select an agency with LTS permissions.
If you do not have one, click Create Agency, choose Cloud Service / FunctionGraph, and grant the required LTS-related permissions in the authorization settings. -
Click Create Function.
-
Copy all scripts from the
Huaweicloud/Functiongraphdirectory into the function code source, and add environment variables to specify the forwarding target:DATAKIT_IP: IP address of the DataKit deployment, when forwarding to DataKitDATAKIT_PORT: Service port of DataKit, when forwarding to DataKitDATAWAY_URL: DataWay URL (for example:https://xx-openway.xxx.com), when forwarding to DataWayWORKSPACE_TOKEN: Workspace Token, when forwarding to DataWay
Note: You must choose either DataKit or DataWay as the forwarding target.
- If you choose DataKit, configure
DATAKIT_IP - If you choose DataWay, configure both
DATAWAY_URLandWORKSPACE_TOKEN
-
If forwarding to DataKit and the DataKit port is not the default
9529, add the environment variableDATAKIT_PORTand set it to the correct port. -
Click Add Trigger.
-
Set Trigger Type to Log Tank Service (LTS).
-
Select the Log Group you want to listen to, then click Add.
To create LTS log groups, create log streams, and write events into those streams in the current region and Huawei Cloud account, the following permissions are required:
lts:*:get
lts:*:list
functiongraph:*:*