Class: LogStash::Outputs::MicrosoftSentinelOutputInternal::LogStashEventsBatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/sentinel_la/logStashEventsBatcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(logstashLoganalyticsConfiguration) ⇒ LogStashEventsBatcher

Returns a new instance of LogStashEventsBatcher.



11
12
13
14
15
# File 'lib/logstash/sentinel_la/logStashEventsBatcher.rb', line 11

def initialize(logstashLoganalyticsConfiguration)
    @logstashLoganalyticsConfiguration = logstashLoganalyticsConfiguration
    @logger = @logstashLoganalyticsConfiguration.logger
    @client = LogAnalyticsClient::new(logstashLoganalyticsConfiguration)
end

Instance Method Details

#batch_event_document(event_document) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/logstash/sentinel_la/logStashEventsBatcher.rb', line 18

def batch_event_document(event_document)
    # todo: ensure the json serialization only occurs once. 
    current_document_size = event_document.to_json.bytesize
    if (current_document_size >= @logstashLoganalyticsConfiguration.MAX_SIZE_BYTES - 1000)
        @logger.error("Received document above the max allowed size - dropping the document [document size: #{current_document_size}, max allowed size: #{@buffer_config[:flush_each]}")
    else
        batch_event(event_document)
    end
end