Collection Methods

Last updated: 2020-02-24 14:28:54


Collection methods

CLS provides multiple collection methods:

Collection method Description
Collect logs via API You can upload structured logs to CLS by calling CLS API. For more information, see Uploading Structured Logs.
Collect logs via SDK Collecting via SDK is not supported at this time.
Collect logs via LogListener client LogListener is a log collection client provided by CLS. You can quickly access CLS by simply configuring LogListener on the console. For more information, see LogListener Use Process.

A comparison of the collection methods is as follows:

Category name Collection by LogListener Collection via API
Code modification Provides a non-intrusive collection method for applications, without code modification. Reports logs only after modifying application code.
Resumable upload Supports resumable upload of logs. Automatically implemented by code.
Retransmission upon failure Provides an inherent retry mechanism. Automatically implemented by code.
Local cache Supports local cache, ensuring data integrity during peak hours. Automatically implemented by code.
Resource occupation Occupies resources such as memory and CPU. Occupies no additional resources.

Accessing log sources

You can access different log sources in different ways. For more information, see the following tables:

Log source category

Log source category Recommended access method
Direct program output API
Local log file LogListener

Log source environment

System environment Recommended access method
Linux/Unix LogListener
Windows API (Currently, LogListener does not support Windows.)
iOS/Android API (Currently, no iOS/Android SDK is available.)

Cloud product logs

Cloud Product Name Recommended access method
CVM Install and configure LogListener
Standard LVB Console configuration, access guidelines
Serverless Cloud Function (SCF) Console (For more information, see the access instructions.)
Tencent Kubernetes Engines (TKE) Console (For more information, see the access guide.)
Network flow log FL Console configuration