class Fluent::RemoteSyslogTcpOutput
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_remote_syslog_tcp.rb, line 23 def initialize super require "remote_syslog_logger_custom" require "socket" @loggers = {} end
Public Instance Methods
emit(tag, es, chain)
click to toggle source
# File lib/fluent/plugin/out_remote_syslog_tcp.rb, line 35 def emit(tag, es, chain) es.each do |time, record| new_record = {} record.each_pair do |k, v| if k == 'msec' new_record["timestamp"] = "#{time.to_s}.#{v}".to_f elsif v.is_a?(String) new_record[k] = v.force_encoding("utf-8") else new_record[k] = v end end new_record["test_msg"] = time tag = rewrite_tag!(tag.dup) @loggers[tag] ||= RemoteSyslogLoggerCustom::TcpSender.new(@host, @port, facility: new_record['facility'] || @facility, severity: new_record["severity"] || @severity, program: tag, local_hostname: Socket.gethostname) @loggers[tag].transmit format(tag, time, new_record) end chain.next end
shutdown()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_remote_syslog_tcp.rb, line 30 def shutdown @loggers.values.each(&:close) super end