Skip to content

Instantly share code, notes, and snippets.

@ksauzz
Created September 29, 2011 16:54
Show Gist options
  • Save ksauzz/1251259 to your computer and use it in GitHub Desktop.
Save ksauzz/1251259 to your computer and use it in GitHub Desktop.
fluent input plugin sample
<source>
type xxxx
host 192.168.x.x
port 1999
</source>
module Fluent
class XXXXInput < Input
# pluginの登録
Fluent::Plugin.register_input('xxxx', self)
def initialize
super
# 初期化処理
end
def configure(conf)
super
# 設定ファイルの情報をconfから取得してpluginにセットする
@host = conf.has_key?('host') ? conf['host'] : 'localhost'
@port = conf.has_key?('port') ? conf['port'] : 9999
end
def start
super
# fluent起動後のデータ取得処理。
.....
# tag, time, recodeを取得してbufferへ渡す
Engine.emit(@tag, Fluent::Event.new(time, record))
end
def shutdown
super
# リソースの解放などの終了処理
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment