Sha256: c09e806b200b7ba710ec77815caa94c0d623a7152667b2cddb24619d972a3575

Contents?: true

Size: 935 Bytes

Versions: 11

Compression:

Stored size: 935 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
      Fluent::Engine.emit(@tag, time, r)
    }
    chain.next
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fluent-plugin-forest-0.3.0 test/output/out_forest_test.rb
fluent-plugin-forest-0.2.4 test/output/out_forest_test.rb
fluent-plugin-forest-0.2.3 test/output/out_forest_test.rb
fluent-plugin-forest-0.2.2 test/output/out_forest_test.rb
fluent-plugin-forest-0.2.1 test/output/out_forest_test.rb
fluent-plugin-forest-0.2.0 test/output/out_forest_test.rb
fluent-plugin-forest-0.1.4 test/output/out_forest_test.rb
fluent-plugin-forest-0.1.3 test/output/out_forest_test.rb
fluent-plugin-forest-0.1.2 test/output/out_forest_test.rb
fluent-plugin-forest-0.1.1 test/output/out_forest_test.rb
fluent-plugin-forest-0.1.0 test/output/out_forest_test.rb