Class: Fluent::Plugin::OutSyslogSEKOIA
- Inherits:
-
Output
- Object
- Output
- Fluent::Plugin::OutSyslogSEKOIA
- Defined in:
- lib/fluent/plugin/out_sekoia.rb
Constant Summary collapse
- DEFAULT_FORMATTER =
"sekoia"
Instance Method Summary collapse
Instance Method Details
#close ⇒ Object
41 42 43 44 45 |
# File 'lib/fluent/plugin/out_sekoia.rb', line 41 def close super @sockets.each_value { |s| s.close } @sockets = {} end |
#configure(config) ⇒ Object
20 21 22 23 24 |
# File 'lib/fluent/plugin/out_sekoia.rb', line 20 def configure(config) super @sockets = {} @formatter = formatter_create end |
#write(chunk) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fluent/plugin/out_sekoia.rb', line 26 def write(chunk) socket = find_or_create_socket(@transport.to_sym, @host, @port) tag = chunk..tag chunk.each do |time, record| begin socket.write_nonblock @formatter.format(tag, time, record) IO.select(nil, [socket], nil, 1) || raise(StandardError.new "ReconnectError") rescue => e @sockets.delete(socket_key(@transport.to_sym, @host, @port)) socket.close raise e end end end |