Skip to content

Instantly share code, notes, and snippets.

@repeatedly
Created July 26, 2013 08:26
Show Gist options
  • Select an option

  • Save repeatedly/6087206 to your computer and use it in GitHub Desktop.

Select an option

Save repeatedly/6087206 to your computer and use it in GitHub Desktop.
Patch for TimeSlicedOutput#emit
diff --git a/lib/fluent/output.rb b/lib/fluent/output.rb
index 475a87b..476dba5 100644
--- a/lib/fluent/output.rb
+++ b/lib/fluent/output.rb
@@ -494,8 +494,10 @@ module Fluent
end
end
- def emit(tag, es, chain)
+ def emit(tag, es, chain)
@emit_count += 1
+
+ emits = {}
es.each {|time,record|
tc = time / @time_slice_cache_interval
if @before_tc == tc
@@ -505,10 +507,12 @@ module Fluent
key = @time_slicer.call(time)
@before_key = key
end
- data = format(tag, time, record)
+ (emits[key] ||= '') << format(tag, time, record)
+ }
+ emits.each { |key, data|
if @buffer.emit(key, data, chain)
submit_flush
- end
+ end
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment