Preparation
Download lts_cleanse.zip (including code file write_log.py of function A, code file lts_cleanse.py of function B, and dependency huaweicloudsdklts) and lts_cleanse.zip.sha256 to filter logs in real time.
Collecting and Storing Logs
- Create two log groups, for example, test1206 and test-1121, on the LTS console. For details, see Creating a Log Group.
- Create two log streams, for example, test-206 and test-1121, on the LTS console. For details, see Creating a Log Stream.
- Create function A to write logs to test-206. For the sample code of this function, see the write_log.py file.
- Create function B with an LTS trigger to receive logs from test-206, process the logs, and write the result to test-1121. For the sample code of this function, see the lts_cleanse.py file.
- Configure an agent to collect logs from servers, such as ECSs, to a specified log group. For details, see Installing the ICAgent.
Figure 1 Flowchart
Creating an Agency
- Log in to the IAM console.
- Choose Agencies from the navigation pane, and click Create Agency in the upper right corner, as shown in Figure 2.
- Configure the agency.
- Agency Name: Enter LtsOperation.
- Agency Type: Select Cloud service.
- Cloud Service: Select FunctionGraph.
- Validity Period: Select Unlimited.
- Description: Describe the agency.
- Click Next. On the displayed page, search for LTS Administrator and Tenant Administrator in the search box on the right and select them, as shown in Figure 3.
LTS Administrator depends on Tenant Guest. When you select the former, the latter will also be selected.
- Click Next and select the application scope of the permission based on service requirements.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.