lib/fluent/plugin/out_couch.rb in fluent-plugin-couch-0.1.4 vs lib/fluent/plugin/out_couch.rb in fluent-plugin-couch-0.1.5
- old
+ new
@@ -38,11 +38,16 @@
end
end
module Fluent
class CouchOutput < BufferedOutput
+
+ include SetTagKeyMixin
+ config_set_default :include_tag_key, false
+
include SetTimeKeyMixin
+ config_set_default :include_time_key, true
Fluent::Plugin.register_output('couch', self)
config_param :database, :string => nil do |val|
'/'+val
@@ -73,15 +78,11 @@
record.to_msgpack
end
def write(chunk)
records = []
- chunk.open { |io|
- begin
- MessagePack::Unpacker.new(io).each { |record| records << record }
- rescue EOFError
- # EOFError always occured when reached end of chunk.
- end
+ chunk.msgpack_each {|record|
+ records << record
}
#TODO: bulk insert
for record in records
@couch.post(@database,record.to_json)
end