Included Modules

Class/Module Index [+]

Quicksearch

Fluent::SetTimeKeyMixin

Attributes

include_time_key[RW]
localtime[RW]
time_key[RW]

Public Instance Methods

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

  if s = conf['include_time_key']
    b = Config.bool_value(s)
    if s.empty?
      b = true
    elsif b == nil
      raise ConfigError, "Invalid boolean expression '#{s}' for include_time_key parameter"
    end
    @include_time_key = b
  end

  if @include_time_key
    if time_key = conf['time_key']
      @time_key = time_key
    end
    unless @time_key
      @time_key = 'time'
    end

    if time_format = conf['time_format']
      @time_format = time_format
    end

    if localtime = conf['localtime']
      @localtime = true
    elsif utc = conf['utc']
      @localtime = false
    end

    @timef = TimeFormatter.new(@time_format, @localtime)

  else
    @include_time_key = false
  end
end
filter_record(tag, time, record) click to toggle source
# File lib/fluent/mixin.rb, line 174
def filter_record(tag, time, record)
  super
  if @include_time_key
    record[@time_key] = @timef.format(time)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.