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



41
42
43
# File 'lib/logstash/outputs/splunk_hec.rb', line 41

def close
  flush_batch if @event_batch.any?
end

#receive(event) ⇒ Object



33
34
35
36
37
38
# File 'lib/logstash/outputs/splunk_hec.rb', line 33

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
# File 'lib/logstash/outputs/splunk_hec.rb', line 24

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