fluent / fluent-bit

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

es: Logstash_Prefix_Key with static prefix #8773

Open jplitza opened 6 months ago

jplitza commented 6 months ago

Bug Report

Describe the bug

Specifying the Logstash_Prefix_Key option with a static prefix (like containers-$kubernetes['namespace_name']) doesn't work, although they should be valid according to docs.

To Reproduce

Expected behavior

The log is inserted into the index "containers-default" if the log came from a container in the namespace "default" and the kubernetes filter plugin added the kubernetes.namespace_name

Screenshots

Your Environment

Additional context

This is the relevant code line, which only checks if the first character of the Logstash_Prefix_Key value is $ and prepends $ otherwise, while (IMO) it should check if the value contains a $: https://github.com/fluent/fluent-bit/blob/9c7a4bf20a6949eaa2f60f1d6635707d0e2e6f13/plugins/out_es/es_conf.c#L329

patrick-stephens commented 6 months ago

A workaround is just to create another key with your prefix using another filter then use that.

jplitza commented 6 months ago

@patrick-stephens Could you maybe point me towards the right filter to achieve that? We are currently using Lua for that purpose, but that causes trouble with type conversions (#3343 to be precise, and the config key that was introduced there is no suitable workaround for us)

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the exempt-stale label.

jplitza commented 3 months ago

This issue is still relevant and even has a corresponding PR.

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the exempt-stale label.

jplitza commented 2 weeks ago

This issue is still relevant and still has a corresponding PR.