0

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

ただし、callfluentd を実行した後、メソッドは実行されません。どんな助けでも大歓迎です。

4

1 に答える 1

2

v0.12 以降、parseの代わりに使用しcallます。docs.fluentd.org は時代遅れだったので、記事を更新しました: http://docs.fluentd.org/articles/plugin-development#parser-plugins

ドキュメントの更新を忘れて申し訳ありません...

于 2015-06-12T09:50:52.677 に答える