Class: Fluent::RemoteSyslogOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::RemoteSyslogOutput
- Includes:
- HandleTagNameMixin, Mixin::ConfigPlaceholders, Mixin::PlainTextFormatter, Mixin::RewriteTagName
- Defined in:
- lib/fluent/plugin/out_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.
23 24 25 26 27 |
# File 'lib/fluent/plugin/out_remote_syslog.rb', line 23 def initialize super require "remote_syslog_logger" @loggers = {} end |
Instance Method Details
#emit(tag, es, chain) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fluent/plugin/out_remote_syslog.rb', line 34 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) @loggers[tag] ||= RemoteSyslogLogger::UdpSender.new(@host, @port, facility: @facility, severity: @severity, program: tag, local_hostname: @hostname) @loggers[tag].transmit format(tag, time, record) end end |
#shutdown ⇒ Object
29 30 31 32 |
# File 'lib/fluent/plugin/out_remote_syslog.rb', line 29 def shutdown super @loggers.values.each(&:close) end |