class Fluent::LogzioOutput

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_logzio.rb, line 6
def configure(conf)
  super
  $log.debug "Logzio url #{@endpoint_url}"
end
emit(tag, es, chain) click to toggle source
# 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() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_logzio.rb, line 19
def shutdown
  super
end
start() click to toggle source
Calls superclass method
# 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