class Fluent::LogseneOutput
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_logsene.rb, line 20 def initialize super end
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_logsene.rb, line 24 def configure(conf) super end
format(tag, time, record)
click to toggle source
# File lib/fluent/plugin/out_logsene.rb, line 32 def format(tag, time, record) [tag, time, record].to_msgpack end
shutdown()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_logsene.rb, line 36 def shutdown super end
start()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_logsene.rb, line 28 def start super end
write(chunk)
click to toggle source
# File lib/fluent/plugin/out_logsene.rb, line 40 def write(chunk) messages = [] case @format when 'json' chunk.msgpack_each do |tag, time, record| if @include_tag_key record.merge!(@tag_key => tag) end if @include_time_key record.merge!(@time_key => @timef.format(time)) end messages << record.to_json end when 'text' chunk.msgpack_each do |tag, time, record| messages << record['message'] end end http = Net::HTTP.new(@host, @port.to_i) http.use_ssl = false http.verify_mode = OpenSSL::SSL::VERIFY_NONE http.set_debug_output $stderr request = Net::HTTP::Post.new(@path + "/" + @logtype) request.body = messages.join("\n") http.request(request) end