Collect Server Logs

Last updated: 2020-01-02 14:36:51


File Log Collection

Log collection feature allows you to collect logs under the specified CVM paths on all nodes in the Kubernetes cluster. You can configure required paths in a flexible manner based on your own needs. Log collection Agent collects the file logs under the paths that meet the specified path rules on all nodes in the cluster. Collected log information is output to the specified output end in the format of json, and attached with specified metadata, including the path of source file and user-defined metadata.

How to Configure

  1. Create log collection rule

  2. Specify source path and add custom Metadata (optional)

  3. Specify log receiver

  4. View received logs

Log Collection Path

Users can specify the path of a log file to collect the log file under the corresponding path on the node in the cluster. A file path or a path that contains wildcard is supported, for example, /var/log/nginx.log or /var/lib/docker/containers/*/*.log.


Users can attach a specified Metadata in Key-Value format to collected logs as the Metadata tag for log information. Attached Metadata is added to the log record in the format of json field.

For example, when no Metadata is attached, the collected data is

When users attach a specified Metadata, the collected data is

Compared to the logs with no specified Metadata, json logs attached with Metadata have an additional key service.

What is Log Metadata

Field Name Meaning
path Source file
message Log information
Custom key Custom value