Module: Fluent::Compat::AddTimeSliceKeyToChunkMixin
- Defined in:
- lib/fluent/compat/output.rb
Instance Method Summary collapse
- #assume_timekey! ⇒ Object
- #key ⇒ Object
- #time_slice_format=(format) ⇒ Object
- #timekey=(unit) ⇒ Object
- #timezone=(tz) ⇒ Object
Instance Method Details
#assume_timekey! ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/fluent/compat/output.rb', line 83 def assume_timekey! @_formatter = Fluent::Timezone.formatter(@_timezone, @_time_slice_format) return if self..timekey if self.respond_to?(:path) && self.path =~ /\.(\d+)\.(?:b|q)(?:[a-z0-9]+)/ begin self..timekey = Time.parse($1, @_time_slice_format).to_i rescue ArgumentError # unknown format / value as timekey end end unless self..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..timekey = time_int - (time_int % @_timekey) end end |
#key ⇒ Object
102 103 104 |
# File 'lib/fluent/compat/output.rb', line 102 def key @_formatter.call(self..timekey) end |
#time_slice_format=(format) ⇒ Object
71 72 73 |
# File 'lib/fluent/compat/output.rb', line 71 def time_slice_format=(format) @_time_slice_format = format end |
#timekey=(unit) ⇒ Object
75 76 77 |
# File 'lib/fluent/compat/output.rb', line 75 def timekey=(unit) @_timekey = unit end |
#timezone=(tz) ⇒ Object
79 80 81 |
# File 'lib/fluent/compat/output.rb', line 79 def timezone=(tz) @_timezone = tz end |