lib/fluent/plugin/out_loggly_buffered.rb in fluent-plugin-loggly-0.0.5 vs lib/fluent/plugin/out_loggly_buffered.rb in fluent-plugin-loggly-0.0.6
- old
+ new
@@ -37,11 +37,11 @@
def start
super
require 'net/http/persistent'
@uri = URI @loggly_url
- @http = Net::HTTP::Persistent.new 'fluentd-plugin-loggly'
+ @http = Net::HTTP::Persistent.new 'fluentd-plugin-loggly', :ENV
@http.headers['Content-Type'] = 'text'
end
def shutdown
super
@@ -52,10 +52,10 @@
end
def write(chunk)
records = []
chunk.msgpack_each {|tag,time,record|
- record['timestamp'] = Time.at(time).iso8601 if @output_include_time
+ record['timestamp'] ||= Time.at(time).iso8601 if @output_include_time
records.push(record.to_json)
}
$log.debug "#{records.length} records sent"
post = Net::HTTP::Post.new @uri.path
post.body = records.join("\n")