Sha256: 91e8437bb2175adb081e397b1cc961441db1c3317dfe6f4704cbe18f47d9211e

Contents?: true

Size: 927 Bytes

Versions: 3

Compression:

Stored size: 927 Bytes

Contents

class Fluent::ForestTestOutput < Fluent::Output
  Fluent::Plugin.register_output('forest_test', self)

  config_param :key_name, :string, :default => 'msg'
  config_param :tag
  config_param :prefix, :string, :default => ''
  config_param :suffix, :string, :default => ''
  config_param :tagfield, :string, :default => nil

  attr_accessor :started, :stopped

  def configure(conf)
    super

    if @tag == 'raise.error'
      raise Fluent::ConfigError, "specified to raise.error"
    end
  end

  def start
    super
    @started = true
  end

  def shutdown
    super
    @stopped = true
  end

  def emit(tag, es, chain)
    es.each {|time, record|
      r = record.merge({@key_name => @prefix + record[@key_name] + @suffix})
      unless @started
        r = r.merge({'not_started' => true})
      end
      if @tagfield
        r[@tagfield] = tag
      end
      router.emit(@tag, time, r)
    }
    chain.next
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fluent-plugin-forest-0.3.3 test/output/out_forest_test.rb
fluent-plugin-forest-0.3.2 test/output/out_forest_test.rb
fluent-plugin-forest-0.3.1 test/output/out_forest_test.rb