Module: Fluent::GelfPluginUtil

Included in:
Plugin::GelfOutput, TextFormatter::GelfFormatter
Defined in:
lib/fluent/plugin/gelf_plugin_util.rb

Constant Summary collapse

LEVEL_MAP =
{
  "0" => GELF::UNKNOWN, "1" => GELF::UNKNOWN, "a" => GELF::UNKNOWN,
  "2" => GELF::FATAL, "c" => GELF::FATAL,
  "3" => GELF::ERROR,
  "4" => GELF::WARN, "w" => GELF::WARN,
  "5" => GELF::INFO, "n" => GELF::INFO,
  "6" => GELF::INFO, "i" => GELF::INFO,
  "7" => GELF::DEBUG, "d" => GELF::DEBUG,
  "e" => GELF::ERROR  # assuming 'e' stands typically for 'error'
}.freeze

Instance Method Summary collapse

Instance Method Details

#make_gelfentry(tag, time, record, conf = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/fluent/plugin/gelf_plugin_util.rb', line 17

def make_gelfentry(tag, time, record, conf = {})
  gelfentry = {'_fluentd_tag' => tag, 'timestamp' => calculate_timestamp(time)}

  record.each_pair do |k, v|
    gelfentry.merge!(process_record_entry(k, v, conf, gelfentry))
  end

  ensure_short_message(gelfentry)
  gelfentry.compact
end