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

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 一直以来,我都陷于开不了口的羞愧中。 试假设:一、无论如何,善良的读者都会包容我。二、我有天赋,能写。以上两个假设...
    甜馨阅读 1,634评论 0 1
  • 还记得我第一次听说《正面管教》是在一次阅读训练活动中,小伙伴为我推荐的。之后我马上将书买回来。因为自从我从事教育,...
    拂景阅读 3,593评论 0 0
  • 欢迎关注:王晓龙的学习史,微信公众号:“xiaolong-learning”期待您的到来! 你有没有这样的经历,对...
    王晓龙的学习史阅读 4,231评论 0 2

友情链接更多精彩内容