class Fluent::TextParser::ValuesParser

Public Instance Methods

configure(conf) click to toggle source
# File lib/fluent/parser.rb, line 299
def configure(conf)
  super

  if @time_key && !@keys.include?(@time_key) && @estimate_current_event
    raise ConfigError, "time_key (#{@time_key.inspect}) is not included in keys (#{@keys.inspect})"
  end

  if @time_format && !@time_key
    raise ConfigError, "time_format parameter is ignored because time_key parameter is not set. at #{conf.inspect}"
  end

  @time_parser = TimeParser.new(@time_format)
  @mutex = Mutex.new
end
values_map(values) click to toggle source
# File lib/fluent/parser.rb, line 314
def values_map(values)
  record = Hash[keys.zip(values)]

  if @time_key
    value = @keep_time_key ? record[@time_key] : record.delete(@time_key)
    time = if value.nil?
             if @estimate_current_event
               Engine.now
             else
               nil
             end
           else
             @mutex.synchronize { @time_parser.parse(value) }
           end
  elsif @estimate_current_event
    time = Engine.now
  else
    time = nil
  end

  convert_field_type!(record) if @type_converters

  return time, record
end

Private Instance Methods

convert_field_type!(record) click to toggle source
# File lib/fluent/parser.rb, line 341
def convert_field_type!(record)
  @type_converters.each_key { |key|
    if value = record[key]
      record[key] = convert_type(key, value)
    end
  }
end