Search code examples
rubyopenstackfluentd

fluent custom plugin registration throws "Unknown output plugin"


I am trying to modify an existing Fluentd plugin and use it with my customization. So I :

  1. git cloned the plugin repo from github. git clone <url>
  2. Edited my changes
  3. gem build plugin.gemspec
  4. gem install plugin.gem
  5. Created a config mentioning the type of plugin
  6. Ran fluentd -c <fluend_conf.conf> -vv

And I ended up getting this in fluentd log(fluent-plugin-swift is the plugin I edited and the type of the plugin is 'swift'):

2017-03-22 15:00:27 +0000 [info]: fluent/engine.rb:126:block in configure: 
gem 'fluent-plugin-swift' version '0.0.1'

2017-03-22 15:00:27 +0000 [error]: fluent/supervisor.rb:369:rescue in
main_process: config error file="fluend_conf.conf" error="Unknown output plugin 
'swift'. Run 'gem search -rd fluent-plugin' to find plugins" 

EDIT-1: For clarifications I have also checked the naming convention of the plugin that is to be registered. The plugin is present in <base_dir>/lib/fluent/plugin/. Also the name of file is out_swift.rb. And finally inside the file, the plugin gets registered as:

Fluent::Plugin.register_output('swift', self)

Also is there any way, I can check the list of registered plugins, and the name it uses to get registered to fluend?

NOTE: The same had previously worked for me, I had to re-do this as someone had formatted the machine I had my changes.

Please let me what is wrong in my approach?


Solution

  • The problem could be with the installation path, Please check the following, :

    Type gem environment

    You will get to see the INSTALLATION DIRECTORY like:

    RubyGems Environment:
      - RUBYGEMS VERSION: 2.6.8
      - RUBY VERSION: 2.4.0 (2016-12-24 patchlevel 0) [x86_64-linux]
      - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.4.0
      - USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.4.0
      - RUBY EXECUTABLE: /usr/local/bin/ruby
      - EXECUTABLE DIRECTORY: /usr/local/bin
      - SPEC CACHE DIRECTORY: /root/.gem/specs
      - SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
      - RUBYGEMS PLATFORMS:
        - ruby
        - x86_64-linux
    

    Go inside the INSTALLATION DIRECTORY directory, now do

    cd gem/<ur_custom_plugin>
    

    Now check whether, your files are there or not. If not, you got your answer.

    SOLUTION: Simply copy your files to this directory and start fluentd