Class: Fluent::LogzioOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::LogzioOutput
- Defined in:
- lib/fluent/plugin/out_logzio.rb
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
6 7 8 9 |
# File 'lib/fluent/plugin/out_logzio.rb', line 6 def configure(conf) super $log.debug "Logzio url #{@endpoint_url}" end |
#emit(tag, es, chain) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fluent/plugin/out_logzio.rb', line 23 def emit(tag, es, chain) chain.next es.each {|time,record| record_json = Yajl.dump(record) $log.debug "Record sent #{record_json}" post = Net::HTTP::Post.new @uri.request_uri post.body = record_json begin response = @http.request @uri, post $log.debug "HTTP Response code #{response.code}" $log.error response.body if response.code != '200' rescue StandardError $log.error "Error connecting to logzio verify the url #{@endpoint_url}" end } end |
#shutdown ⇒ Object
19 20 21 |
# File 'lib/fluent/plugin/out_logzio.rb', line 19 def shutdown super end |
#start ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/fluent/plugin/out_logzio.rb', line 11 def start super require 'net/http/persistent' @uri = URI @endpoint_url @http = Net::HTTP::Persistent.new 'fluent-plugin-logzio-ng', :ENV @http.headers['Content-Type'] = 'application/json' end |