【问题标题】:adding a custom plugin to google-fluentd向 google-fluentd 添加自定义插件
【发布时间】:2020-08-15 01:32:52
【问题描述】:

我需要捕获给定进程的文件描述符。这与 collectd 的 processes 插件的功能类似,但需要在 fluentd、google-fluentd 特别是 rails 上实现。

我已经在 /etc/google-fluentd/plugin 目录下添加了我的插件,但运气不好,它没有被注册。我什至在/opt/google-fluentd/embedded/lib/ruby/gems/2.6.0/gems/fluentd-1.7.4/lib/fluent/plugin 下移动了仍然没有运气。出于绝望,我也尝试将 in_tail.rb 重命名为 in_tail2.rb,tail 插件不见了。

2020-08-14 18:28:16 -0700 [error]: fluent/log.rb:362:error: config error file="/etc/google-fluentd/google-fluentd.conf" error_class=Fluent::ConfigError error="Unknown input plugin 'tail'. Run 'gem search -rd fluent-plugin' to find plugins"

这告诉我还有其他地方必须提到插件。认为我可以在 /etc/google-fluentd/plugin 下只写一个文件插件是不是太天真了?

【问题讨论】:

    标签: google-cloud-platform fluentd


    【解决方案1】:

    在 fluentd 中的调用堆栈上下移动几个小时后,我试图找出 fluentd 加载的原因和插件背后的逻辑。

    @type 必须匹配注册调用和文件名!

    我用过

    @type fc_count
    

    我的文件名是 /etc/google-fluentd/in_fd.rb 与

     Fluent::Plugin.register_input('fd_count', self)
    

    虽然类型和注册匹配,但 fluent 在加载配置时无法匹配到 plugin/in_fd.rb 的文件路径。基本上,如果您不使用插件,它将不会加载它,并且它确定它的方式是通过配置。这就是我重命名现有输入插件时找不到它的原因。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-11
    • 1970-01-01
    • 2014-04-01
    • 2022-08-19
    • 1970-01-01
    • 2019-08-13
    相关资源
    最近更新 更多