SCF Log

Last updated: 2020-01-02 10:14:20

PDF

Overview

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.

Prerequisites

CLS is activated.

Access directions

  1. 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.
  2. Log in to the SCF Console. Click Functions In the left sidebar to enter the function service list page.
  3. 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.
  4. On the Function Configuration page, configure the logset and log topic created in Step 1 for the function service, then click Save.
  5. 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.
  6. In the upper-right corner, click Edit, enable Index Status and Full-Text Index, then click Save.

    For more operations, such as real-time log search, log shipping and consumption, log in to the CLS Console. For more features, see the CLS Overview document.

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.

  1. Log in to the CLS Console. Click Log Search in the left sidebar to enter the log search page.
  2. 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.
  3. Click Search to search the logs.
    The following figure shows how to search for logs containing Memory.