Class: LogStash::Outputs::MicrosoftSentinelOutputInternal::LogsSender
- Inherits:
-
EventsHandler
- Object
- EventsHandler
- LogStash::Outputs::MicrosoftSentinelOutputInternal::LogsSender
- Defined in:
- lib/logstash/sentinel_la/logsSender.rb
Instance Method Summary collapse
- #close ⇒ Object
- #handle_events(events) ⇒ Object
-
#initialize(logstashLogAnalyticsConfiguration) ⇒ LogsSender
constructor
A new instance of LogsSender.
Methods inherited from EventsHandler
Constructor Details
#initialize(logstashLogAnalyticsConfiguration) ⇒ LogsSender
Returns a new instance of LogsSender.
12 13 14 15 16 17 |
# File 'lib/logstash/sentinel_la/logsSender.rb', line 12 def initialize(logstashLogAnalyticsConfiguration) @thread_batch_map = Concurrent::Hash.new @logstashLogAnalyticsConfiguration = logstashLogAnalyticsConfiguration @logger = logstashLogAnalyticsConfiguration.logger super end |
Instance Method Details
#close ⇒ Object
40 41 42 43 44 |
# File 'lib/logstash/sentinel_la/logsSender.rb', line 40 def close @thread_batch_map.each { |thread_id, batcher| batcher.close } end |
#handle_events(events) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/logstash/sentinel_la/logsSender.rb', line 19 def handle_events(events) t = Thread.current unless @thread_batch_map.include?(t) @thread_batch_map[t] = @logstashLogAnalyticsConfiguration.compress_data ? LogStashCompressedStream::new(@logstashLogAnalyticsConfiguration) : LogStashAutoResizeBuffer::new(@logstashLogAnalyticsConfiguration) end events.each do |event| # creating document from event document = create_event_document(event) # Skip if document doesn't contain any items next if (document.keys).length < 1 @logger.trace("Adding event document - " + event.to_s) @thread_batch_map[t].batch_event_document(document) end end |