class Fluent::Timestamper

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_timestamper.rb, line 9
def configure(conf)
  super
end
emit(tag, es, chain) click to toggle source
# File lib/fluent/plugin/out_timestamper.rb, line 13
def emit(tag, es, chain)
  now = Time.now

  es.each do |time, record|
    case @format
    when "seconds"
      record[@key] = now.to_i
    when "milliseconds"
      record[@key] = (now.to_i * 1000) + (now.usec / 1000.0).round
    when "iso8601"
      record[@key] = now.iso8601
    else
      record[@key] = now.strftime(@format)
    end

    Fluent::Engine.emit(@tag, time, record)
  end

  chain.next
end