Skip to content

Does not work for "labels.app.kubernetes.io/name" #2

Open
@123BLiN

Description

@123BLiN

Is your feature request related to a problem? Please describe.
I'm using logging operator with tag_normalizer and trying to route logs to different idexes with https://github.com/uken/fluent-plugin-elasticsearch#dynamic-configuration. Somehow I'm not able to use ${kubernetes.labels.app-kubernetes-io/name} as a placeholder for index name pattern but ${tag} works, so I've decided to try to adjust tag itself however same problem here - I'm not able to use ${labels.app-kubernetes-io/name}` as a value in tag - it is always empty (unknown)

Describe the solution you'd like to see
Maybe I need to use some special syntax I'm not aware about

Describe alternatives you've considered
Tried to set index name with placeholders but it does not work either

Additional context
When I'm trying to run tests from this repo but with another set of labels - it works, but it does not work in the real life fluentd :(

  test "lables_test" do
    config = %[
      format cluster.${namespace_name}.${labels.app.kubernetes.io/name}
    ]
    record = {
        "log" => "Example",
        "kubernetes" => {
            "pod_name" => "understood-butterfly-nginx-logging-demo-7dcdcfdcd7-h7p9n",
            "namespace_name" => "default",
            "labels" => {
              "app" => {
                "kubernetes" => {
                  "io/name" => "traefik",
                  "io/managed-by" => "helm"
                }
              }
            } 
        }
    }
    d = create_driver(config)
    d.run(default_tag: 'test') do
      d.feed("tag1", event_time, record.dup)
      d.feed("tag1", event_time, record.dup)
    end
    events = d.events
    puts events
  end

result:

{"log"=>"Example", "kubernetes"=>{"pod_name"=>"understood-butterfly-nginx-logging-demo-7dcdcfdcd7-h7p9n", "namespace_name"=>"default", "labels"=>{"app"=>{"kubernetes"=>{"io/name"=>"traefik", "io/managed-by"=>"helm"}}}}}
cluster.default.traefik

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions