Sha256: 06e00fab0e9890d00a77bd30c71dd0ac3fa6e5d8926ca026eb8b71e22cb8614b

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

module Fluent
  class SelectOutput < Fluent::Output
    Fluent::Plugin.register_output('select', self)

    config_param :select, :string
    config_param :add_prefix, :string
    config_param :timeout, :integer, :default => 1

    def emit(tag, es, chain)
      begin
        time_records = []
        es.each {|time, record|
          if eval(@select)
            $log.trace {"hoge"}
            time_records << [time, record]
          else
            $log.trace {"filtered: #{Time.at(time)} #{tag} #{record.inspect}"}
          end
        }
        time_records.each do |time, record|
          Fluent::Engine::emit(@add_prefix + "." + tag, time, record)
        end
        chain.next
        time_records #for test
      rescue SyntaxError => e
        chain.next
        $log.error "Select command is syntax error: #{@select}"
        e #for test
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluent-plugin-select-0.0.2 lib/fluent/plugin/out_select.rb