Discovery

服务发现和配置下发相关的配置。目前主要为Kubernetes相关全局配置。

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

字段类型是否必填默认值含义
enabledbool非必填false是否开启服务发现配置下发模块

Kubernetes

字段类型是否必填默认值含义
clusterstring非必填“”标识Loggie集群名称。Loggie支持在一个Kubernetes集群中部署多套Loggie,可以通过在LogConfig CRD中指定selector.cluster,指定配置下发的Loggie集群
kubeconfigstring非必填指定请求Kubernetes集群API的kubeconfig文件。通常在Loggie部署到Kubernetes集群中无需填写,此时为inCluster模式。如果Loggie部署在Kubernetes集群外(例如本地调试时),需要指定该kubeconfig文件。
masterstring非必填指定请求Kubernetes集群API的master地址,inCluster模式一般无需填写
containerRuntimestring非必填docker容器运行时,可选dockercontainerdnone
rootFsCollectionEnabledbool非必填false是否开启采集root filesystem里的日志,用于不挂载日志volume的场景
parseStdoutbool非必填false是否开启自动提取容器标准输出原始内容
dynamicContainerLogbool非必填false是否开启动态容器日志配置,打开后配置文件不会渲染具体的path和动态fields字段,可以有效避免大规模容器化场景里Pod变动从而导致配置的频繁渲染,显著减少reload次数,特别是在单节点的Pod个数较多和使用clusterlogconfig匹配大量的Pod时。一般建议设置为true。
kubeletRootDirstring非必填/var/lib/kubeletkubelet的root路径
podLogDirPrefixstring非必填/var/log/podskubernetes默认放置的pod标准输出路径
typePodFieldsmap非必填当logconfig/clusterlogconfig里selector为type: pod时,自动添加的kubernetes相关元信息,key即为添加的元信息key,value请使用${_k8s.XX}的方式指定,同时支持填写固定值的key:value字段
typeNodeFieldsmap非必填当logconfig/clusterlogconfig里selector为type: node时,自动添加的kubernetes相关元信息,key即为添加的元信息key,value请使用${_k8s.XX}的方式指定,同时支持填写固定值的key:value字段

typePodFields支持的变量

“${_k8s.XX}”的方式可填写以下参数:

字段类型是否必填默认值含义
${_k8s.logconfig}string非必填添加logConfig name作为元信息
${_k8s.node.name}string非必填添加所在节点node name作为元信息
${_k8s.node.ip}string非必填添加所在节点node ip作为元信息
${_k8s.pod.namespace}string非必填添加namespace作为元信息
${_k8s.pod.name}string非必填添加pod name作为元信息
${_k8s.pod.ip}string非必填添加pod ip作为元信息
${_k8s.pod.uid}string非必填添加pod uid作为元信息
${_k8s.pod.container.name}string非必填添加container name作为元信息
${_k8s.pod.container.id}string非必填添加container id作为元信息
${_k8s.pod.container.image}string非必填添加container image作为元信息
${_k8s.workload.kind}string非必填添加pod归属的Deployment/Statefulset/DaemonSet/Job作为元信息
${_k8s.workload.name}string非必填添加pod归属的Deployment/Statefulset/DaemonSet/Job名称作为元信息

typeNodeFields支持的变量

“${_k8s.XX}”的方式可填写以下参数:

字段类型是否必填默认值含义
${_k8s.clusterlogconfig}string非必填添加clusterlogconfig name作为元信息
${_k8s.node.name}string非必填添加所在节点node name作为元信息
${_k8s.node.addresses.InternalIP}string非必填添加node InternalIP 作为元信息
${_k8s.node.addresses.Hostname}string非必填添加node Hostname作为元信息
${_k8s.node.nodeInfo.kernelVersion}string非必填添加node kernelVersion作为元信息
${_k8s.node.nodeInfo.osImage}string非必填添加node osImage作为元信息
${_k8s.node.nodeInfo.containerRuntimeVersion}string非必填添加node containerRuntimeVersion作为元信息
${_k8s.node.nodeInfo.kubeletVersion}string非必填添加node kubeletVersion作为元信息
${_k8s.node.nodeInfo.kubeProxyVersion}string非必填添加node kubeProxyVersion作为元信息
${_k8s.node.nodeInfo.operatingSystem}string非必填添加node operatingSystem作为元信息
${_k8s.node.nodeInfo.architecture}string非必填添加node architecture作为元信息
${_k8s.node.labels.}string非必填添加node的某个label作为元信息,其中的<key>请替换成具体的label key
${_k8s.node.annotations.}string非必填添加node的某个annotation作为元信息,其中的<key>请替换成具体的annotation key