fluent / fluent-bit

Fast and Lightweight Logs and Metrics processor for Linux, BSD, OSX and Windows
https://fluentbit.io
Apache License 2.0
5.9k stars 1.59k forks source link

Unable to set both a custom Index name and Date (Fluent-bit x OpenSearch) #9650

Open rdvansloten opened 6 days ago

rdvansloten commented 6 days ago

Bug Report

Describe the bug When configuring fluent-bit forOpenSearch, I can't seem to get both the Kubernetes namespace and date in the index. I want my Indexes to look like this:

MY_KUBERNETES_CLUSTER-$NAMESPACE-$DATE

So for a cluster called "mycluster" and namespace "development" this would be the result: mycluster-namespace-2024-11-26

When enabling Logstash, I can set the date, but the clustername+namespace rendering does not work as intended. I can only do clustername+date or namespace+date. It doesn't accept a plain string next to the variable.

To Reproduce

Expected behavior To be able to format my indexes the way I see fit and combine all the given puzzle pieces.

Your Environment

rdvansloten commented 6 days ago

I used a "hack" but it puts the items in the wrong order.

        Logstash_Format On
        Logstash_Prefix_Key $kubernetes['namespace_name']
        Logstash_Prefix_Separator -mycluster-
        Logstash_DateFormat %Y-%m-%d

resulting in development-mycluster-2024-11-26

But it looks super dirty