Class: Fluent::TextParser::NodejsBunyanParser
- Inherits:
-
JSONishParser
- Object
- JSONParser
- JSONishParser
- Fluent::TextParser::NodejsBunyanParser
- Defined in:
- lib/fluent/plugin/parser_nodejs_bunyan.rb
Instance Method Summary collapse
Methods inherited from JSONishParser
Constructor Details
This class inherits a constructor from Fluent::TextParser::JSONishParser
Instance Method Details
#configure(conf) ⇒ Object
8 9 10 |
# File 'lib/fluent/plugin/parser_nodejs_bunyan.rb', line 8 def configure(conf) super(conf.update({ 'time_key' => 'time', 'message_key' => 'msg'})) end |
#parse(text) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fluent/plugin/parser_nodejs_bunyan.rb', line 12 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) # Cannot be disabled in the library and serves no purpose, # since it never varies. record.delete('v') # Fluent expects the host to be keyed with 'host', not 'hostname'. record['host'] = record.delete('hostname') record.delete('hostname') # Passing 'message_key' only duplicates the key to 'message' -- # it does not delete the original key (which is unneeded). record.delete(@message_key) yield time, record end end |