Last updated: 2020-01-02 10:14:20PDF
When Serverless Cloud Function (SCF) is used for function computing, a high number of function execution logs are generated. SCF is connected to CLS of Tencent Cloud, and SCF can collect function execution logs and push them to CLS in real time. CLS supports multiple log operations, such as search, shipping, and consumption.
CLS is activated.
- Log in to the CLS Console, and create a logset and a log topic. Set the region of the logset to the same as that of the SCF. Currently, cross-region log pushing is not supported. For more information, see Creating a Logset and a Log Topic.
- Log in to the SCF Console. Click Functions In the left sidebar to enter the function service list page.
- Click the name of the function for which logs need to be collected in real time, after which the Function Configuration page is displayed. In the upper-right corner of the page, click Edit to edit the function information.
- On the Function Configuration page, configure the logset and log topic created in Step 1 for the function service, then click Save.
- Now you have accessed the CLS platform. To search logs, manually enable the index.
Log in to the CLS Console, click Logset Management, and choose the target logset and log topic. On the log topic tab, in the Operation column on the right, choose Configure > Index Configuration to enter the index configuration page.
- In the upper-right corner, click Edit, enable Index Status and Full-Text Index, then click Save.
Real-time search example
Before using the real-time search feature, make sure that your function service logs can access the CLS platform and that the index feature is enabled for the log topic to search. If index is not enabled, see the Enabling Index document.
- Log in to the CLS Console. Click Log Search in the left sidebar to enter the log search page.
- Select the time range and log topic to search, then enter the search syntax in the input box. The syntax supports search by keyword, fuzzy match, and scope. For more information, see Syntax and Rules.
- Click Search to search the logs.
The following figure shows how to search for logs containing Memory.