Class: Fluent::LogseneOutput
- Inherits:
-
BufferedOutput
- Object
- BufferedOutput
- Fluent::LogseneOutput
- Includes:
- SetTagKeyMixin, SetTimeKeyMixin
- Defined in:
- lib/fluent/plugin/out_logsene.rb
Instance Method Summary collapse
- #configure(conf) ⇒ Object
- #format(tag, time, record) ⇒ Object
-
#initialize ⇒ LogseneOutput
constructor
A new instance of LogseneOutput.
- #shutdown ⇒ Object
- #start ⇒ Object
- #write(chunk) ⇒ Object
Constructor Details
#initialize ⇒ LogseneOutput
Returns a new instance of LogseneOutput.
19 20 21 |
# File 'lib/fluent/plugin/out_logsene.rb', line 19 def initialize super end |
Instance Method Details
#configure(conf) ⇒ Object
23 24 25 |
# File 'lib/fluent/plugin/out_logsene.rb', line 23 def configure(conf) super end |
#format(tag, time, record) ⇒ Object
31 32 33 |
# File 'lib/fluent/plugin/out_logsene.rb', line 31 def format(tag, time, record) [tag, time, record].to_msgpack end |
#shutdown ⇒ Object
35 36 37 |
# File 'lib/fluent/plugin/out_logsene.rb', line 35 def shutdown super end |
#start ⇒ Object
27 28 29 |
# File 'lib/fluent/plugin/out_logsene.rb', line 27 def start super end |
#write(chunk) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/fluent/plugin/out_logsene.rb', line 39 def write(chunk) = [] 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 << record.to_json end when 'text' chunk.msgpack_each do |tag, time, record| << record['message'] end end http = Net::HTTP.new(@host, @port.to_i) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE http.set_debug_output $stderr request = Net::HTTP::Post.new(@path) request.body = .join("\n") http.request(request) end |