Using app.kubernetes.io/name label

Hi,
I am trying to define service as the content of app.kubernetes.io/name label if it empty by:

    if ![service] and [kubernetes][labels][app_kubernetes_io/name] {
        mutate {
            add_field => { "service" => '[kubernetes][labels][app_kubernetes_io/name]'}
        }
    } 

And a lot of variants of it (e.g. "%{[kubernetes][labels][app_kubernetes_io/name]"}) but failed (with above, I got the text instead the value).
I am using Logstash 7.16.3.
Thanks

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