Class: Fluent::TextParser::NodejsBunyanParser

Inherits:
JSONishParser
  • Object
show all
Defined in:
lib/fluent/plugin/parser_nodejs_bunyan.rb

Instance Method Summary collapse

Methods inherited from JSONishParser

#initialize

Constructor Details

This class inherits a constructor from Fluent::TextParser::JSONishParser

Instance Method Details

#configure(conf) ⇒ Object



8
9
10
11
12
13
# File 'lib/fluent/plugin/parser_nodejs_bunyan.rb', line 8

def configure(conf)
  super(conf)
  @time_key = 'time'
  @message_key = 'msg'
  @move_keys.update({ 'v' => nil, 'msg' => nil, 'hostname' => 'host' })
end

#parse(text) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/fluent/plugin/parser_nodejs_bunyan.rb', line 15

def parse(text)
  super(text) do |time, record|
    # Map the developer-defined levels to  syslog levels.
    record['level'] = 8+(record['level']<=30?1:0)-(record['level']/10)
    yield time, record
  end
end