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



46
47
48
# File 'lib/logstash/outputs/splunk_hec.rb', line 46

def close
  flush_batch if @event_batch.any?
end

#receive(event) ⇒ Object



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

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

#registerObject



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

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