Class: Fluent::RemoteSyslogOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::RemoteSyslogOutput
- Includes:
- HandleTagNameMixin, Mixin::ConfigPlaceholders, Mixin::PlainTextFormatter, Mixin::RewriteTagName
- Defined in:
- lib/fluent/plugin/out_kubernetes_remote_syslog.rb
Instance Method Summary collapse
- #emit(tag, es, chain) ⇒ Object
-
#initialize ⇒ RemoteSyslogOutput
constructor
A new instance of RemoteSyslogOutput.
- #shutdown ⇒ Object
Constructor Details
#initialize ⇒ RemoteSyslogOutput
Returns a new instance of RemoteSyslogOutput.
25 26 27 28 29 |
# File 'lib/fluent/plugin/out_kubernetes_remote_syslog.rb', line 25 def initialize super require "remote_syslog_sender" @loggers = {} end |
Instance Method Details
#emit(tag, es, chain) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/fluent/plugin/out_kubernetes_remote_syslog.rb', line 36 def emit(tag, es, chain) chain.next es.each do |time, record| record.each_pair do |k, v| if v.is_a?(String) v.force_encoding("utf-8") end end tag = rewrite_tag!(tag.dup) if @protocol.downcase == 'tcp' @loggers[tag] ||= RemoteSyslogLogger::TcpSender.new(@host, @port, facility: @facility, severity: @severity, packet_size: @packet_size, program: tag, local_hostname: record['kubernetes_host']) else @loggers[tag] ||= RemoteSyslogLogger::UdpSender.new(@host, @port, facility: @facility, severity: @severity, packet_size: @packet_size, program: tag, local_hostname: record['kubernetes_host']) end @loggers[tag].transmit format(tag, time, record) end end |
#shutdown ⇒ Object
31 32 33 34 |
# File 'lib/fluent/plugin/out_kubernetes_remote_syslog.rb', line 31 def shutdown super @loggers.values.each(&:close) end |