logstash-core/lib/logstash/pipeline.rb
# Take an array of events and send them to the correct output
Take an array of events and send them to the correct output
Take an array of events and send them to the correct output
def output_batch(batch)
    output_events_map = Hash.new { |h, k| h[k] = [] }
    batch.each do |event|
      (output_func(event) || []).each do |output|
        output_events_map[output].push(event)
      end
    end
    output_events_map.each do |output, events|
      return if @force_shutdown.true?
      output.multi_receive(events)
    end
    @filter_queue_client.add_output_metrics(batch)
  end
def output_batch ( batch ) output_events_map = Hash . new { | h , k | h [ k ] = [ ] } batch . each do | event | ( output_func ( event ) || [ ] ) . each do | output | output_events_map [ output ] . push ( event ) end end output_events_map . each do | output , events | return if @force_shutdown . true? output . multi_receive ( events ) end @filter_queue_client . add_output_metrics ( batch ) end
Take an array of events and send them to the correct output
Take an array of events and send them to the correct output
# Build a mapping of { output_plugin => [events...]} # We ask the AST to tell us which outputs to send each event to # Then, we stick it in the correct bin # output_func should never return anything other than an Array but we have lots of legacy specs # that monkeypatch it and return nil. We can deprecate  "|| []" after fixing these specs # Now that we have our output to event mapping we can just invoke each output # once with its list of events
batch