Unable to use kubernetes metadata in custom fields


(Amith Ganesh) #1

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}

(Noémi Ványi) #2

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


(Amith Ganesh) #3

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