更新时间:2022-09-16 GMT+08:00
分享

标准输出配置

通过添加指定采集容器标准输出标签,用户可以指定采集pod下的对应容器名的标准输出日志。用户在pod的yaml中spec:template:metadata:annotations:字段增加以下字段来实现指定要采集的容器名称。

kubernetes.AOM.log.stdout: '["container_name0", "container_name1"]'

规则如下:

  1. 如果没有kubernetes.AOM.log.stdout:字段,默认采集该pod下全部容器的标准输出日志,兼容原有场景。
  2. 如果存在该字段,值为空,即kubernetes.AOM.log.stdout: '[]'则不采集该pod下容器的标准输出日志。

示例:

spec:
  replicas: 1
  selector:
    matchLabels:
      app: als729
      version: v1
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: als729
        version: v1
      annotations:
        kubernetes.AOM.log.relabel: '{"key1":"value1","key2":"value2","key3":"value3","key4":"value4","key5":"value5","key6":"value6","key7":"value7","key8":"value8","key9":"value9","key10":"value10","key11":"value11","key12":"value12","key13":"value13","key14":"value14","key15":"value16"}'
        kubernetes.AOM.log.stdout: '["container-0","container_name1"]'

相关文档