class Fluent::Plugin::SerializeJSONParser
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/parser_serialize_nested_json.rb, line 14 def configure(conf) if conf.has_key?('time_format') conf['time_type'] ||= 'string' end super end
parse(text) { |time, record| ... }
click to toggle source
# File lib/fluent/plugin/parser_serialize_nested_json.rb, line 22 def parse(text) record = Yajl.load(text) values = Hash.new record.each do |k, v| next if @exclude.include?(k.to_s) if v.is_a?(Hash) || v.is_a?(Array) begin values[k] = Yajl::Encoder.encode(v) record.delete k rescue Exception => e # continue end end if v.is_a?(Numeric) && @strinfify_num == true begin values[k] = v.to_s record.delete k rescue Exception => e end end end record.merge!(values) time, record = convert_values(parse_time(record), record) yield time, record rescue Yajl::ParseError yield nil, nil end