class Fluent::Plugin::TcpSocketOutput
Public Instance Methods
get_client()
click to toggle source
# File lib/fluent/plugin/out_tcp_socket.rb, line 62 def get_client if @@socket == nil @@socket = TCPSocket.open(hostname, port) log.info "Socket established for %s:%s" % [hostname, port] end return @@socket end
process(tag, es)
click to toggle source
# File lib/fluent/plugin/out_tcp_socket.rb, line 43 def process(tag, es) es.each do |time, record| @@queue.enq("%s\r\n" % [record]) end end
start()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_tcp_socket.rb, line 28 def start super log.info "TCP Plugin started with %s:%s" % [hostname, port] @@execution_thread = Thread.new { start_service_thread } end
start_service_thread()
click to toggle source
# File lib/fluent/plugin/out_tcp_socket.rb, line 49 def start_service_thread log.info "TCP Plugin thread started for %s:%s" % [hostname, port] while record = @@queue.deq begin get_client.puts record rescue log.error "client error %s" %[$!] @@socket = nil @@queue.enq record end end end
stop()
click to toggle source
# File lib/fluent/plugin/out_tcp_socket.rb, line 34 def stop if @@execution_thread != nil Thread.kill(@@execution_thread) log.info "TCP Plugin thread has been killed" end @@queue.close log.info "Queue is closed" end