Class: LogStash::Codecs::Excel

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

Overview

The “xls” codec is mainly used for xls input

Instance Method Summary collapse

Instance Method Details

#decode(data) {|event| ... } ⇒ Object

Yields:

  • (event)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/logstash/codecs/excel.rb', line 26

def decode(data)
  if data.is_a? Hash
    line = ""
    data[:row].each do |col|
      line << "#{col};"
    end

    event = LogStash::Event.new("message" => @converter.convert(line.rstrip))
    event.tag("eof") if data[:eof]
    event["wsname"] = data[:wsname]
  end

  yield event
end

#encode(event) ⇒ Object



42
43
44
# File 'lib/logstash/codecs/excel.rb', line 42

def encode(event)
  @on_event.call data
end

#registerObject



20
21
22
23
# File 'lib/logstash/codecs/excel.rb', line 20

def register
  @converter = LogStash::Util::Charset.new(@charset)
  @converter.logger = @logger
end