module Fluent::Compat::SetTimeKeyMixin
Attributes
include_time_key[RW]
localtime[RW]
time_key[RW]
timezone[RW]
Private Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/compat/set_time_key_mixin.rb, line 29 def configure(conf) @include_time_key = false @localtime = false @timezone = nil super if s = conf['include_time_key'] include_time_key = Fluent::Config.bool_value(s) raise Fluent::ConfigError, "Invalid boolean expression '#{s}' for include_time_key parameter" if include_time_key.nil? @include_time_key = include_time_key end if @include_time_key @time_key = conf['time_key'] || 'time' @time_format = conf['time_format'] if conf['localtime'] @localtime = true elsif conf['utc'] @localtime = false end if conf['timezone'] @timezone = conf['timezone'] Fluent::Timezone.validate!(@timezone) end @timef = Fluent::TimeFormatter.new(@time_format, @localtime, @timezone) end end
filter_record(tag, time, record)
click to toggle source
Calls superclass method
Fluent::Compat::RecordFilterMixin#filter_record
# File lib/fluent/compat/set_time_key_mixin.rb, line 62 def filter_record(tag, time, record) super record[@time_key] = @timef.format(time) if @include_time_key end