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