Using label

I am trying to define service as the content of 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.

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