Unable to use kubernetes metadata in custom fields

I am unable to access kubernetes metadata in custom fields. Can someone please help?
config:

    - type: docker
      containers.ids:
        - "*"
      fields_under_root: true
      processors:
        - add_kubernetes_metadata:
            in_cluster: true
        - drop_fields:
            fields: ["host"]
      multiline.pattern: '^{"log":"[0-9]{4}-[0-9]{2}-[0-9]{2}'
      multiline.negate: true
      multiline.match: after
      fields:
        hostname: ${data.kubernetes.pod.name}

The field is called ${kubernetes.pod.name}, not ${data.kubernetes.pod.name}.

i tried using ${kubernetes.pod.name}. it's not working when i use it. It gives an error stating that this field does not exists

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