Skip to content

Commit

Permalink
out_es: Allow Logstash_Prefix_Key with prefix
Browse files Browse the repository at this point in the history
The option Logstash_Prefix_Key should be a record accessor.

There is a convenience feature that automatically prefixes a $ when the value is just a static string (since that is expected to be set as Logstash_Prefix instead).

However, record accessor can contain the $ not just at the beginning. One example would be
  containers-$kubernetes['namespace_name']

This patch thus makes the autodetection look for a $ in the whole value, not just the first character.

Signed-off-by: Jan-Philipp Litza <[email protected]>
  • Loading branch information
jplitza authored and Jan-Philipp Litza committed May 31, 2024
1 parent ea7b9f4 commit 8348709
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/out_es/es_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ struct flb_elasticsearch *flb_es_conf_create(struct flb_output_instance *ins,
}

if (ctx->logstash_prefix_key) {
if (ctx->logstash_prefix_key[0] != '$') {
if (strchr(ctx->logstash_prefix_key, '$') == NULL) {
len = flb_sds_len(ctx->logstash_prefix_key);
buf = flb_malloc(len + 2);
if (!buf) {
Expand Down

0 comments on commit 8348709

Please sign in to comment.