When Serverless Cloud Function (SCF) is used for function computing, a high number of function execution logs are generated. As connected to Tencent Cloud CLS, 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.
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.
To search for logs, you need to enable index manually. If you have done so, skip Steps 2-5.
Log in to the CLS Console, and click Logset. Select the logset you want, and click Manage* under the Operation column to enter the logset details page.
Select the Index Configuration tab.
Click Edit, toggle on Index Status, Full-Text Index and Key-Value Index, and then add key-value indexes.
Once completed, click Save.
|SCF_Index||Log line No.||long|
Log in to the SCF Console. Click Function Service in the left sidebar to enter the functions list page.
Click the name of the function for real-time log collection, after which the Function Configuration page is displayed. In the upper-right corner, click Edit to edit the function information.
Configure the logset and log topic created in Step 1 for the function service, then click Save.
Before using the real-time search feature, make sure that your SCF logs are connected to CLS and that index is enabled for the log topic to be searched. If index is not enabled, see Enabling Index.
SCF_StartTime:1583233118007searches for logs with a timestamp 1583233118007.
SCF_Index:2searches for logs matching an index of 2.