fluent-plugin-opensearch
fluent-plugin-opensearch copied to clipboard
AWS credentials are refreshed every 5 seconds instead of 5 hours, which is default value of`refresh_credentials_interval`
(check apply)
- [x] read the contribution guideline
- [x] (optional) already reported 3rd party upstream repository or mailing list if you use k8s addon or helm charts.
Steps to replicate
- Add
log.info('Recreate the AWS credentials')
in thetimer_execute()
block - Run fluent-plugin-opensearch
- See the log file of fluentd
2024-03-05 05:04:46 +0000 [info]: #0 Recreate the AWS credentials
2024-03-05 05:04:51 +0000 [info]: #0 Recreate the AWS credentials
2024-03-05 05:04:56 +0000 [info]: #0 Recreate the AWS credentials
Expected Behavior or What you need to ask
Recreate the AWS credentials every 5 hours
Using Fluentd and OpenSearch plugin versions
- OS version: Amazon Linux 2
- Bare Metal or within Docker or Kubernetes or others?: Bare Metal
- Fluentd v1.0 or later: fluentd 1.16.3
- OpenSearch plugin version: fluent-plugin-opensearch (1.1.4)
- OpenSearch version (optional): 1.3
- OpenSearch template(s) (optional)
The reason is that interval
in the timer_execute()
is integer
or float
and not string
like 5h
https://docs.fluentd.org/plugin-helper-overview/api-plugin-helper-timer#methods
cool.io, which is used by fluentd to implement timer_execute()
, calls interval.to_f
to get the actual interval value.
https://github.com/socketry/cool.io/blob/master/ext/cool.io/timer_watcher.c#L66
Since '5h'.to_f
is 5.0
, timer_execute()
executes aws_credentials()
every 5 seconds.
Thanks for your report! You are right, the default value should be specified as integer instead of string:
https://github.com/fluent/fluent-plugin-opensearch/blob/0762b3f4b3f9d77cef13b562ae76a264ec8f26de/lib/fluent/plugin/out_opensearch.rb#L198
https://github.com/fluent/fluent-plugin-opensearch/blob/0762b3f4b3f9d77cef13b562ae76a264ec8f26de/lib/fluent/plugin/out_opensearch.rb#L347-L355