Class: Fluent::Plugin::FormatterSyslogRFC5424
- Inherits:
-
Formatter
- Object
- Formatter
- Fluent::Plugin::FormatterSyslogRFC5424
- Defined in:
- lib/fluent/plugin/formatter_syslog_rfc5424.rb
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
12 13 14 15 16 |
# File 'lib/fluent/plugin/formatter_syslog_rfc5424.rb', line 12 def configure(conf) super @app_name_field_array = @app_name_field.split(".") @proc_id_field_array = @proc_id_field.split(".") end |
#format(tag, time, record) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fluent/plugin/formatter_syslog_rfc5424.rb', line 18 def format(tag, time, record) log.debug("Tag") log.debug(tag.to_s) log.debug("Record") log.debug(record.map { |k, v| "#{k}=#{v}" }.join('&')) msg = RFC5424::Formatter.format( log: record['log'], timestamp: time, app_name: record.dig(*@app_name_field_array) || "-", proc_id: record.dig(*@proc_id_field_array) || "-" ) log.debug("RFC 5424 Message") log.debug(msg) return msg unless @rfc6587_message_size msg.length.to_s + ' ' + msg end |