uken / fluent-plugin-elasticsearch

Apache License 2.0
891 stars 310 forks source link

`ilm_policy` is ignored if `ilm_policy_id` contains placeholder #957

Open dsch opened 2 years ago

dsch commented 2 years ago

(check apply)

Problem

If ilm_policy_id contains placeholders the default policy gets created instead of the one configured ilm_policy.

Steps to replicate

config snipped:

index_name fluentd-${tag}
enable_ilm    true
template_name logstash
template_file /path/template-file.json
ilm_policy_id fluentd-${tag}
ilm_policy {"policy":{"phases":{"hot":{"actions":{"rollover":{"max_size":"75gb","max_age": "50d"}}}}}}
ilm_policy_overwrite false

Log

2022-03-23 10:13:01 +0000 [info]: #0 [flow:k8s-demo:demo:clusteroutput:cattle-logging-system:elastic-cloud] The alias 'fluentd-demo' is created for the index '<fluentd-demo-default-{now/d}-000001>'
2022-03-23 10:13:01 +0000 [info]: #0 [flow:k8s-demo:demo:clusteroutput:cattle-logging-system:elastic-cloud] Installing ILM policy: {"policy"=>{"phases"=>{"hot"=>{"actions"=>{"rollover"=>{"max_size"=>"50gb", "max_age"=>"30d"}}}}}}

Expected Behavior or What you need to ask

The configure ILM policy should be created.

Using Fluentd and ES plugin versions

dsch commented 2 years ago

A possible source of the problem could the buried in the handling of ilm_policies:

the policy gets added to ilm_policies under the ilm_policy_id containing the placeholders: https://github.com/uken/fluent-plugin-elasticsearch/blob/96ff1706282a3bdb77533b72d3792d692530b547/lib/fluent/plugin/out_elasticsearch.rb#L244-L246

later the policy get retrieved from ilm_policies with ilm_policy_idwith expanded placeholders, which results in an empty ilm_policy. https://github.com/uken/fluent-plugin-elasticsearch/blob/96ff1706282a3bdb77533b72d3792d692530b547/lib/fluent/plugin/out_elasticsearch.rb#L1082

naviat commented 1 year ago

I wanted to check if there has been any progress on this ticket. Can you please let me know if you have been able to resolve it from your end? @dsch