美文网首页
fluentd插件式架构,支持二次开发插件式架构,支持二次开发

fluentd插件式架构,支持二次开发插件式架构,支持二次开发

作者: 风恋绝尘 | 来源:发表于2016-12-22 00:18 被阅读0次

http://noops.me/?p=1325

class SomeOutput < Fluent::Output

First, register the plugin. NAME is the name of this plugin

and identifies the plugin in the configuration file.

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

This method is called before starting.

def configure(conf)
super
...
end

This method is called when starting.

def start
super
...
end

This method is called when shutting down.

def shutdown
super
...
end

This method is called when an event reaches Fluentd.

'es' is a Fluent::EventStream object that includes multiple events.

You can use 'es.each {|time,record| ... }' to retrieve events.

'chain' is an object that manages transactions. Call 'chain.next' at

appropriate points and rollback if it raises an exception.

def emit(tag, es, chain)
chain.next
es.each {|time,record|
$stderr.puts "OK!"
}
end
end

相关文章

网友评论

      本文标题:fluentd插件式架构,支持二次开发插件式架构,支持二次开发

      本文链接:https://www.haomeiwen.com/subject/imjcvttx.html