Sha256: 518953e2767e9c465ebf1781f9bdd4695e4a9ca119c633f046cd8a633db9b226

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

module Fluent
  class MapOutput < Fluent::Output
    Fluent::Plugin.register_output('map', self)

    config_param :map, :string
    config_param :multi, :bool, :default => false

    def configure(conf)
      super
      $log.debug { "map: #{@map}" }
    end

    def emit(tag, es, chain)
      tuples = []
      es.each {|time, record|
        new_tuple = eval(@map)
        if @multi
          tuples.concat new_tuple
        else
          tuples << new_tuple
        end
      }
      tuples.each do |tag, time, record|
        $log.trace { [tag, time, record].inspect }
        Fluent::Engine::emit(tag, time, record)
      end
      chain.next
      tuples
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluent-plugin-map-0.0.1 lib/fluent/plugin/out_map.rb