Class: LogStash::Outputs::SplunkHec

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/outputs/splunk_hec.rb

Instance Method Summary collapse

Instance Method Details

#closeObject



44
45
46
# File 'lib/logstash/outputs/splunk_hec.rb', line 44

def close
  flush_batch if @event_batch.any?
end

#receive(event) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/logstash/outputs/splunk_hec.rb', line 35

def receive(event)
  format_and_add_to_batch(event)
  
  if batch_full? || time_to_flush?
    flush_batch
  end
end

#registerObject



24
25
26
27
28
29
30
31
32
# File 'lib/logstash/outputs/splunk_hec.rb', line 24

def register
  @http = Net::HTTP.new(@host, @port)
  @http.use_ssl = true
  @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
  @uri = URI.parse("https://#{@host}:#{@port}/services/collector/event")
  
  @event_batch = Concurrent::Array.new
  @last_flush = Concurrent::AtomicReference.new(Time.now)
end