Help & DocumentationTencent Kubernetes EngineUser Guide(Old)LogCollecting Logs of a Path in the Container

Collecting Logs of a Path in the Container

Last updated: 2019-06-26 10:45:24

PDF

The log collection service does not allow you to collect log files directly from the file system in the container. To collect logs of a certain path in the container, you need to mount the directory in which the specified log file reside to the specified path of CVM in the format of "host path volume", and then collect the corresponding CVM path using the feature of collecting CVM log files.

How to Make the Configuration

For example, application prints the log file to the file system path /data/app-log/nginx.log in the container. You can configure log collection rules as follows:

  1. Create a log collector and specify the collection path as /var/log/nginx/*.log, and specify a metadata to be attached (optional).

  2. Specify log receiver.

  3. Consume related Topic of Kafka to view collected logs.