SCF was fully connected to CLS starting from January 29, 2021. After then, the invocation logs of newly created functions will be delivered to CLS by default, and logs can be output in real time. If your function was created before January 29, 2021, but you need to search for and deliver logs, please refer to this document to use this feature.
When SCF is used for function computation, a large number of function execution logs will be generated. If you need to persistently store, deliver, or consume logs and monitor and set alarms on log content, you can deliver logs to the Tencent Cloud CLS, as shown below:
Before using the SCF real-time log service, you need to activate CLS first.
Log in to the CLS console and create a logset and log topic. This document uses the creation of the
SCF-test logset and log topic in Guangzhou as an example, as shown below:
For the logset region, please select the region where the SCF service is located. Cross-region log push is not supported currently.
SCF-testas an example, as shown below:
Log search depends on the index configuration of the log topic. After the function is associated with the log topic, SCF will automatically complete the index configuration for the log topic. If the index is exceptional and logs cannot be pulled properly, please adjust the index configuration in the following steps:
For functions configured with CLS, to ensure the display effect of the logs in the SCF console, please toggle on Enable Statistics for the field in key-value index configuration, as shown below:
|Field Name||Field Type||Description|
|SCF_StartTime||long||Invocation start time|
|SCF_LogTime||long||Log generation time|
|SCF_Duration||long||Function execution duration|
|SCF_MemUsage||double||Function runtime memory|
|SCF_Level||text||Log4J log level. Default value: INFO|
|SCF_Type||text||Log type. Platform: platform log, Custom: user log|
|SCF_StatusCode||long||Status code of function execution|
|SCF_RetryNum||long||Number of retries|
For more features, such as real-time log search, log shipping and consumption, see the CLS documents, and log in to the CLS console to use them.
Before using the real-time search feature, please make sure that your SCF log service has been connected to the CLS platform and the index has been enabled for the log topic to be searched.
STARTas an example.
Contact our sales team or business advisors to help your business.
Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.
Was this page helpful?