SCF was fully connected to CLS on January 29, 2021, invocation logs of newly created functions have been delivered to CLS by default since then, 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 do so as instructed in this document.
When SCF is used for function computation, a large number of function execution logs will be generated. You can view and search for logs generated in the last 15 days in Log Query > Advanced Retrieval in the SCF console.
The advanced search feature is currently in beta test. It is visible only to certain functions and can search for logs collected after it was launched. For more information, please see Log Search Guide.
If you need to persistently store, deliver, or consume logs and monitor and set alarms on log content, you can deliver logs to the CLS platform as shown below:
Before using the SCF real-time log service, you need to activate CLS first.
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 retrieval depends on the index configuration of the log topic. Please enable the index as instructed below:
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||Function execution status code.|
|SCF_RetryNum||long||Number of retries.|
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.