fluentd 用のパーサー プラグインを実装しようとしています。以下は設定ファイルとプラグインファイルです。
Fluentd 構成ファイル。
<source>
type syslog
port 9010
bind x.x.x.x
tag flog
format flog_message
</source>
プラグインファイル
module Fluent
class TextParser
class ElogParser < Parser
Plugin.register_parser("flog_message", self)
config_param :delimiter, :string, :default => " " # delimiter is configurable with " " as default
config_param :time_format, :string, :default => nil # time_format is configurable
# This method is called after config_params have read configuration parameters
def configure(conf)
if @delimiter.length != 1
raise ConfigError, "delimiter must be a single character. #{@delimiter} is not."
end
# TimeParser class is already given. It takes a single argument as the time format
# to parse the time string with.
@time_parser = TimeParser.new(@time_format)
end
def call(text)
# decode text
# ...
# decode text
yield result_hash
end
end
end
end
ただし、call
fluentd を実行した後、メソッドは実行されません。どんな助けでも大歓迎です。