Discovery

Configuration related to service discovery and configuration delivery, mainly included in Kubernetes-related global configuration.

Example

  1. discovery:
  2. enabled: true
  3. kubernetes:
  4. # Choose: docker or containerd
  5. containerRuntime: containerd
  6. # Collect log files inside the container from the root filesystem of the container, no need to mount the volume
  7. rootFsCollectionEnabled: false
  8. # Automatically parse and convert the wrapped container standard output format into the original log content
  9. parseStdout: false
  10. # If set to true, it means that the pipeline configuration generated does not contain specific Pod paths and meta information,
  11. # and these data will be dynamically obtained by the file source, thereby reducing the number of configuration changes and reloads.
  12. dynamicContainerLog: false
  13. # Automatically add fields when selector.type is pod in logconfig/clusterlogconfig
  14. typePodFields:
  15. logconfig: "${_k8s.logconfig}"
  16. namespace: "${_k8s.pod.namespace}"
  17. nodename: "${_k8s.node.name}"
  18. podname: "${_k8s.pod.name}"
  19. containername: "${_k8s.pod.container.name}"
  20. typeNodeFields:
  21. nodename: "${_k8s.node.name}"
  22. clusterlogconfig: "${_k8s.clusterlogconfig}"
  23. os: "${_k8s.node.nodeInfo.osImage}"

enabled

fieldtyperequireddefaultdescription
enabledboolfalseWhether to enable the service discovery configuration delivery

kubernetes

fieldtyperequireddefaultdescription
clusterstringfalseIdentifies the Loggie cluster name. Loggie supports deploying multiple sets of Loggie in a Kubernetes cluster. It can be specified in the LogConfig CRD by selector.cluster to specify the Loggie cluster to be configured.
kubeconfigstringfalseSpecifies the kubeconfig file used to connect the Kubernetes API. Usually, it is not required when Loggie is deployed to a Kubernetes cluster. If Loggie is deployed outside Kubernetes (local debug), you need to specify the kubeconfig file.
masterstringfalseSpecify the master address for requesting the Kubernetes cluster API. Generally it do not need to be filled in inCluster mode
containerRuntimestringfalsedockercontainer runtime, docker or containerd
rootFsCollectionEnabledboolfalsefalseWhether to enable the collection of logs in the root filesystem when log volumes are not mounted.
parseStdoutboolfalsefalseWhether to enable automatic extraction of container standard output raw content
dynamicContainerLogboolfalsefalseWhether to enable the dynamic container log configuration. The configuration file will not render the specific path and dynamic fields fields after opening, which can effectively avoid the frequent rendering of the configuration caused by Pod changes in large-scale containerization scenarios, and significantly reduce the number of reloads, especially on a single node. When the number of Pods is large and clusterlogconfig is used to match a large number of Pods, it is generally recommended to set it true.
kubeletRootDirstringfalse/var/lib/kubeletroot path of kubelet
podLogDirPrefixstringfalse/var/log/podsThe path where kubernetes place pod standard output by default
typePodFieldsmapfalseThe kubernetes related meta info automatically added when logconfig/clusterlogconfig use selector type: pod. The key is key of added meta info, and the value should be specified in the form of ${_k8s.XX}. Fixed key:value fields are also supported
typeNodeFieldsmapfalseThe kubernetes related meta info automatically added when logconfig/clusterlogconfig use selector type: node. The key is key of added meta info, and the value should be specified in the form of ${_k8s.XX}. Fixed key:value fields are also supported

Variables supported by typePodFields

“${_k8s.XX}” can be replaced by the following parameters:

fieldtyperequireddefaultdescription
${_k8s.logconfig}stringfalseadd logConfig name as meta
${_k8s.node.name}stringfalseadd node name as meta
${_k8s.node.ip}stringfalseadd node ip as meta
${_k8s.pod.namespace}stringfalseadd namespace as meta
${_k8s.pod.name}stringfalseadd pod name as meta
${_k8s.pod.ip}stringfalseadd pod ip as meta
${_k8s.pod.uid}stringfalseadd pod uid as meta
${_k8s.pod.container.name}stringfalseadd container name as meta
${_k8s.pod.container.id}stringfalseadd container id as meta
${_k8s.pod.container.image}stringfalseadd container image as meta
${_k8s.workload.kind}stringfalseadd Deployment/Statefulset/DaemonSet/Job kind as meta
${_k8s.workload.name}stringfalseadd Deployment/Statefulset/DaemonSet/Job name as meta

Variables supported by typeNodeFields

“${_k8s.XX}” can be replaced by the following parameters:

fieldtyperequireddefaultdescription
${_k8s.clusterlogconfig}stringfalseadd clusterlogconfig nameas meta
${_k8s.node.name}stringfalseadd node nameas meta
${_k8s.node.addresses.InternalIP}stringfalseadd node InternalIP as meta
${_k8s.node.addresses.Hostname}stringfalseadd node Hostname as meta
${_k8s.node.nodeInfo.kernelVersion}stringfalseadd node kernelVersion as meta
${_k8s.node.nodeInfo.osImage}stringfalseadd node osImageas meta
${_k8s.node.nodeInfo.containerRuntimeVersion}stringfalseadd node containerRuntimeVersion as meta
${_k8s.node.nodeInfo.kubeletVersion}stringfalseadd node kubeletVersionas meta
${_k8s.node.nodeInfo.kubeProxyVersion}stringfalseadd node kubeProxyVersionas meta
${_k8s.node.nodeInfo.operatingSystem}stringfalseadd node operatingSystemas meta
${_k8s.node.nodeInfo.architecture}stringfalseadd node architectureas meta
${_k8s.node.labels.}stringfalseadd a label of node as meta. replace <key> with a specific label key
${_k8s.node.annotations.}stringfalseadd an annotation of node as meta. replace <key> with a specific annotation key