How can I add kubernetes metadata for my cri-containerd pods

I am using filebeat 7.16.2 to collect containers stdout which run-time is containerd. MY kubernetes' versin v1.20.10, and containerd version is v1.19.0. Below is some of my filebeat.yaml

    filebeat.inputs:
    - type: log
      paths:
        - /var/log/containers/*/*/*.log
      exclude_files: ["filebeat","kube","cattle-system","metallb-system"]
      fields_under_root: true
      multiline.pattern: '^\s'
      multiline.match: after
      tail_files: false
      clean_removed: true
      processors:
        - add_kubernetes_metadata:
            in_cluster: true
            kube_config:  /data/certs/kubeconfig 

I can collect logs but can not get kubernetes metadata, such as kubernetes namespaces, labels... How can I get the metadata? what wrong with my configuration?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.