lib/fluent/plugin/out_splunk_tcp.rb in fluent-plugin-splunk-enterprise-0.9.0 vs lib/fluent/plugin/out_splunk_tcp.rb in fluent-plugin-splunk-enterprise-0.9.1
- old
+ new
@@ -54,13 +54,13 @@
end
case @format
when 'json'
if @use_fluentd_time
- @formatter = lambda {|time, record| insert_time_to_front(time, record).to_json }
+ @formatter = lambda {|time, record| Yajl.dump(insert_time_to_front(time, record)) }
else
- @formatter = lambda {|_time, record| record.to_json }
+ @formatter = lambda {|_time, record| Yajl.dump(record) }
end
when 'kv'
if @use_fluentd_time
@formatter = lambda {|time, record| format_kv(insert_time_to_front(time, record)) }
else
@@ -88,10 +88,13 @@
return if chunk.empty?
payload = ''
chunk.msgpack_each do |time, record|
event = @formatter.call(time, record)
- payload << (event + @line_breaker) unless event.empty?
+ unless event.empty?
+ payload << event
+ payload << @line_breaker
+ end
end
unless payload.empty?
sock = create_socket
sock.write(payload)