You need to enable JavaScript to run this app.
Torch Log Service

Torch Log Service

Copy page
Download PDF
Collect container logs
Container collection overview
Copy page
Download PDF
Container collection overview
TLS supports collecting container text logs and standard output from Kubernetes clusters. Both DaemonSet and Sidecar collection methods are available. This topic describes the collection methods and collection process of Kubernetes container logs.​
Features​
LogCollector supports collecting log files and standard output inside containers, and uploads the log data together with container metadata to the server. When collecting container logs, LogCollector offers the following capabilities:​
  • Supports universal container collection rules.​
  • You can specify which containers to collect by configuring container label and environment variable allowlist or denylist.​
  • Container metadata, such as names and images, is included as log fields and uploaded to TLS along with the collected log data.​
  • Supports specifying K8s collection rules. When a container runs in Kubernetes, LogCollector provides the following additional features.​
  • Support specifying containers to be collected by configuring Kubernetes Namespace name, Pod name, and workload type and name.​
  • Support specifying the scope of containers to be collected using Pod Label allowlists and denylists.​
  • Container metadata, including Namespace, Pod name, Pod unique identifier, and Pod IP address, will be uploaded as log fields to TLS.​
  • Supports various log collection modes such as single-line, multi-line, and separator, compatible with multiple collection configurations.​
  • When collecting container text logs, you can directly specify the log file path inside the container to collect log data from that path.​
Collection methods​
TLS provides DaemonSet and Sidecar collection methods for container logs in Kubernetes clusters.​
​
Collection methods​
Description​
Documentation​
DaemonSet​
LogCollector is deployed on every node in the K8s cluster. LogCollector collects all required container logs from that node and sends logs to the server.​
LogCollector on each node needs to collect all logs. Its customization capability is relatively limited. Therefore, it is more suitable for clusters with single-function workloads.​
Supports collecting container standard output and container text logs.​
Sidecar​
Run a Sidecar LogCollector container in a POD to collect logs generated by that POD.​
Offers high isolation, suitable for multi-tenant scenarios or situations with performance requirements for log collection.​
Supports collecting container text logs.​
​
Container log collection process​
DaemonSet collection process​
Follow the steps below to install LogCollector and configure container log collection rules.​
  1. Install LogCollector in the Kubernetes cluster.​
  1. Create a host group​
Tip​
We recommend using a host group based on host identification. Set the host identification to the custom identifier configured during LogCollector installation. For steps, see Create host group (Host identification).​
  1. Create log collection configuration in the console​
  • TLS supports collecting text logs via DaemonSet. You can collect container text logs and container standard output from Kubernetes clusters.​
Sidecar collection process​
Follow the steps below to install LogCollector and configure container log collection rules.​
  1. Install LogCollector in the Kubernetes cluster.​
  1. Create a host group​
  • We recommend using a host group based on host identification. Set the host identification to the custom identifier configured during LogCollector installation. For steps, see Create host group (Host identification).​
  1. Create log collection configuration in the console.​
  • Container text logs can be collected via Sidecar. When creating the configuration, you can simply select the mode based on the text log format; you do not need to select the container logs option. For more information, see:​
​
Last updated: 2026.04.20 16:03:51