Class: SumologicConnection

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/out_sumologic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint, verify_ssl, connect_timeout) ⇒ SumologicConnection

Returns a new instance of SumologicConnection.



10
11
12
13
# File 'lib/fluent/plugin/out_sumologic.rb', line 10

def initialize(endpoint, verify_ssl, connect_timeout)
  @endpoint = endpoint
  create_http_client(verify_ssl, connect_timeout)
end

Instance Attribute Details

#httpObject (readonly)

Returns the value of attribute http.



8
9
10
# File 'lib/fluent/plugin/out_sumologic.rb', line 8

def http
  @http
end

Instance Method Details

#publish(raw_data, source_host = nil, source_category = nil, source_name = nil) ⇒ Object



15
16
17
18
19
20
# File 'lib/fluent/plugin/out_sumologic.rb', line 15

def publish(raw_data, source_host=nil, source_category=nil, source_name=nil)
  response = http.post(@endpoint, raw_data, request_headers(source_host, source_category, source_name))
  unless response.ok?
    raise "Failed to send data to HTTP Source. #{response.code} - #{response.body}"
  end
end