Class: LogStash::Outputs::Xlsx

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/outputs/xlsx.rb

Overview

A null output. This is useful for testing logstash inputs and filters for performance.

Instance Method Summary collapse

Instance Method Details

#flush(path) ⇒ Object



83
84
85
86
87
88
89
# File 'lib/logstash/outputs/xlsx.rb', line 83

def flush(path)
  @files.each do |path, package|
    if(File.basename(path) == File.basename(path))
      package.serialize(path)
    end
  end
end

#receive(event) ⇒ Object



60
61
62
63
64
65
66
# File 'lib/logstash/outputs/xlsx.rb', line 60

def receive(event)
  @codec.encode(event)

  if event.include? "tags" and event["tags"].include?("eof")
      flush event['path']
  end
end

#registerObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/logstash/outputs/xlsx.rb', line 33

def register
	@files = {}

  @codec.on_event do |event|
    if @path
      path = event.sprintf(@path)
    else
      path = event["path"]
    end

   if event.is_a? LogStash::Event and @message_format
     output = event.sprintf(@message_format)
   else
     output = event["message"]
   end

   cells = output.split(/;/)

   wsname = event["wsname"]

    worksheet = get_worksheet(path, wsname)

    worksheet.add_row cells
  end
end