Collect Container STD Logs

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

PDF

Collecting Container Logs

Log collection feature is used to collect logs of the specified container in the Kubernetes cluster. You can configure containers from which logs are required to be collected in a flexible manner based on your own needs. Collected log information is output to the user-specified output end in the format of json, and attached with related Kubernetes metadata, including label and annotation of the pod to which the container belongs.

How to Make the Configuration

  1. Create a log collector and specify the service.

  2. Specify the consumer end of logs.

  3. View received logs.

What is Log Metadata

Field Name Meaning
docker.container_id ID of the container to which logs belong
kubernetes.annotations Annotations of the pod to which logs belong
kubernetes.container_name Name of the container to which logs belong
kubernetes.host IP of machine in which the pod of logs resides
kubernetes.labels Labels of the pod to which logs belong
kubernetes.namespace_name Namespace of the pod to which logs belong
kubernetes.pod_id ID of the pod to which logs belong
kubernetes.pod_name Name of the pod to which logs belong
log Log information