Log Service allows you to collect Kubernetes container logs in either the DaemonSet or Sidecar mode. This topic describes the procedures and differences of log collection in the two modes.

Collection methods

Log collection in the DaemonSet mode features simple O&M, low resource usage, and flexible collection of container stdout files, stderr files, and text files. However, in the DaemonSet mode, Logtail collects logs from all containers on a node. This mode has performance bottlenecks and causes a loosely isolated environment for business logs. In the Sidecar mode, a Sidecar container is created for each container from which logs are to be collected. This improves multi-tenant isolation and performance.

Log collection configurations

You can use the Log Service console or use custom resource definitions (CRDs) to configure log collection. The following table lists the differences between CRDs and the console in terms of log collection configurations.
Item CRD Console
Procedure sophistication Low Moderate
Feature Supports all configurations that the console supports and advanced configurations that the console does not support Moderate
Ease of use Moderate Low
Network connection Connects to a Kubernetes cluster Connects to the Internet
Integration with container components Supported Unsupported
Authentication method Authentication method provided by Kubernetes Authentication method based on Alibaba Cloud accounts

Collection process

The following describes the log collection process in the DaemonSet method.

  1. Install Logtail.
  2. Create collection configurations.
    Log Service allows you to configure log collection by using CRDs and the console to collect container logs of Kubernetes clusters.
    Note If you use CRDs to configure log collection, projects, Logstores, indexes, server groups, Logtail configurations, and other resources are automatically created. In addition, log collection configurations better integrate with Kubernetes clusters. If you are configuring log collection from containers for the first time, you can use the console because the operation is easier.
The following describes the log collection process in the Sidecar method.
  1. Install Logtail.
  2. Install Sidecars and create log collection configurations.
    Log service allows you to create collection configurations by using CRDs and the console to collect container logs of Kubernetes clusters.