class Fluent::Plugin::TCPClientOutput
Attributes
formatter[R]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_tcp_client.rb, line 9 def initialize super end
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_tcp_client.rb, line 22 def configure(conf) compat_parameters_convert(conf, :formatter) super @formatter = formatter_create @sock = nil end
format(tag, time, record)
click to toggle source
# File lib/fluent/plugin/out_tcp_client.rb, line 41 def format(tag, time, record) @formatter.format(tag, time, record) end
shutdown()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_tcp_client.rb, line 36 def shutdown super disconnect end
start()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_tcp_client.rb, line 31 def start super connect end
write(chunk)
click to toggle source
# File lib/fluent/plugin/out_tcp_client.rb, line 45 def write(chunk) connect tries ||= 3 chunk.write_to(@sock) rescue => e if (tries -= 1) > 0 reconnect retry else $log.warn("Failed writing data to socket: #{e}") end end
Private Instance Methods
connect()
click to toggle source
# File lib/fluent/plugin/out_tcp_client.rb, line 63 def connect @sock ||= TCPSocket.new(@host, @port) end
disconnect()
click to toggle source
# File lib/fluent/plugin/out_tcp_client.rb, line 67 def disconnect @sock.close rescue nil @sock = nil end
reconnect()
click to toggle source
# File lib/fluent/plugin/out_tcp_client.rb, line 72 def reconnect disconnect connect end