Class: LogStash::Codecs::CSV2

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/codecs/csv2.rb

Overview

The “plain” codec is for plain text with no delimiting between events.

This is mainly useful on inputs and outputs that already have a defined framing in their transport protocol (such as zeromq, rabbitmq, redis, etc)

Instance Method Summary collapse

Instance Method Details

#encode(event) ⇒ Object



29
30
31
32
# File 'lib/logstash/codecs/csv2.rb', line 29

def encode(event)
  csv_values = @fields.map {|name| get_value(name, event)}
  @on_event.call(event,csv_values.to_csv(@csv_options))
end

#registerObject



19
20
21
# File 'lib/logstash/codecs/csv2.rb', line 19

def register
  @csv_options = Hash[@csv_options.map{|(k, v)|[k.to_sym, v]}]
end