I want to use fluentd to read data from a database in a dockerized environment. In the container where I have installed fluentd I put this "fluent.conf" file:
<source>
@type sql
host db
port 3306
database logs-db
adapter mysql2
username john
password johnpassword
tag_prefix docker.logify # optional, but recommended
state_file /var/run/fluentd/sql_state
<table>
table logs-tb
update_column id
</table>
</source>
<match docker.logify>
@type file
path /fluentd/etc/logs/docker.logify.log
</match>
The problem is that when I start the container I get these errors:
2024-02-23 11:00:39 +0000 [error]: #0 unexpected error error_class=NoMethodError error="undefined method `exists?' for File:Class"
2024-02-23 11:00:39 +0000 [error]: #0 /usr/local/lib/ruby/gems/3.2.0/gems/fluent-plugin-sql-2.3.0/lib/fluent/plugin/in_sql.rb:285:in `initialize'
2024-02-23 11:00:39 +0000 [error]: #0 /usr/local/lib/ruby/gems/3.2.0/gems/fluent-plugin-sql-2.3.0/lib/fluent/plugin/in_sql.rb:186:in `new'
2024-02-23 11:00:39 +0000 [error]: #0 /usr/local/lib/ruby/gems/3.2.0/gems/fluent-plugin-sql-2.3.0/lib/fluent/plugin/in_sql.rb:186:in `start'
2024-02-23 11:00:39 +0000 [error]: #0 /usr/local/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/root_agent.rb:203:in `block in start'
2024-02-23 11:00:39 +0000 [error]: #0 /usr/local/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/root_agent.rb:192:in `block (2 levels) in lifecycle'
The fluent-plugin-sql plugin seems to be installed properly, because when I do
fluent-gem list | grep fluent-plugin-sql
I get
fluent-plugin-sql (2.3.0)