# File lib/fluent/output.rb, line 451 def configure(conf) super # TODO timezone if conf['utc'] @localtime = false elsif conf['localtime'] @localtime = true end if @localtime @time_slicer = Proc.new {|time| Time.at(time).strftime(@time_slice_format) } else @time_slicer = Proc.new {|time| Time.at(time).utc.strftime(@time_slice_format) } end @time_slice_cache_interval = time_slice_cache_interval @before_tc = nil @before_key = nil if @flush_interval if conf['time_slice_wait'] $log.warn "time_slice_wait is ignored if flush_interval is specified: #{conf}" end @enqueue_buffer_proc = Proc.new do @buffer.keys.each {|key| @buffer.push(key) } end else @flush_interval = [60, @time_slice_cache_interval].min @enqueue_buffer_proc = Proc.new do nowslice = @time_slicer.call(Engine.now.to_i - @time_slice_wait) @buffer.keys.each {|key| if key < nowslice @buffer.push(key) end } end end end
# File lib/fluent/output.rb, line 498 def emit(tag, es, chain) es.each {|time,record| tc = time / @time_slice_cache_interval if @before_tc == tc key = @before_key else @before_tc = tc key = @time_slicer.call(time) @before_key = key end data = format(tag, time, record) if @buffer.emit(key, data, chain) submit_flush end } end
Generated with the Darkfish Rdoc Generator 2.