Search code examples
fluentd

fluentd cannot find custom filter plugin on Windows with calyptia-fluentd


On this system I have calyptia-fluentd, and I'm trying to develop a custom filter plugin.

To start, I've created a gem with some initial code, and I have installed this gem, and have created a config file with uses the plugin.

However, starting calyptia-fluentd on the command line (the environment is the one provided by the installer, not the generic Windows command prompt) gives me this:

C:\opt\calyptia-fluentd>calyptia-fluentd -vv
2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: parsing config file is succeeded path="C:\\opt\\calyptia-fluentd\\bin\\\\..\\etc\\calyptia-fluentd\\calyptia-fluentd.conf"
2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: gem 'fluentd' version '1.15.0'
2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: gem 'fluent-plugin-calyptia-monitoring' version '0.1.3'

...

2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: gem 'fluent-plugin-custom' version '0.0.3'

...

2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: gem 'fluent-plugin-windows-eventlog' version '0.8.1'
2022-08-11 16:24:23 +0200 [error]: fluent/log.rb:372:error: config error file="C:\\opt\\calyptia-fluentd\\bin\\\\..\\etc\\calyptia-fluentd\\calyptia-fluentd.conf" error_class=Fluent::NotFoundPluginError error="Unknown filter plugin 'filter_custom'. Run 'gem search -rd fluent-plugin' to find plugins"

Note that it says it's loaded the fluent-plugin-custom gem, but then it bombs out with the "Unknown plugin" error.

The plugin code, placed in filter_custom.rb is:

module Fluent::Plugin
  class CustomFilter < Filter

    Fluent::Plugin.register_filter('custom', self)

    # ...

    def filter(tag, time, record)
      record
    end

    # ...

  end
end

I've also tried placing it in /etc/calyptia-fluentd/plugin on a Linux system, with the same problem.

How do I get Fluentd to use the new plugin?


Solution

  • Maybe it will save others time: the plugin code was correct, the gem was correctly installed, but what didn't work was the config file. It referenced filter_custom when it should have referenced just custom.