# File lib/fluent/compat/output.rb, line 82 def assume_timekey! @_formatter = Fluent::Timezone.formatter(@_timezone, @_time_slice_format) return if self.metadata.timekey if self.respond_to?(:path) && self.path =~ /\.(\d+)\.(?:b|q)(?:[a-z0-9]+)/ begin self.metadata.timekey = Time.parse($1, @_time_slice_format).to_i rescue ArgumentError # unknown format / value as timekey end end unless self.metadata.timekey # file creation time is assumed in the time range of that time slice # because the first record should be in that range. time_int = self.created_at.to_i self.metadata.timekey = time_int - (time_int % @_timekey) end end
# File lib/fluent/compat/output.rb, line 101 def key @_formatter.call(self.metadata.timekey) end
# File lib/fluent/compat/output.rb, line 70 def time_slice_format=(format) @_time_slice_format = format end
# File lib/fluent/compat/output.rb, line 74 def timekey=(unit) @_timekey = unit end
# File lib/fluent/compat/output.rb, line 78 def timezone=(tz) @_timezone = tz end