fluent/fluentd · error · Fluent::ConfigError
timekey should be greater than 0. current timekey: #{@timeke
Error message
timekey should be greater than 0. current timekey: #{@timekey} What it means
`timekey` was configured but parses to zero or negative seconds. timekey is a time-typed parameter, so `timekey 0`, `timekey -1h`, or a value that evaluates to 0 passes config parsing and is then rejected by the explicit `@timekey <= 0` check, because a non-positive window cannot bucket records.
Source
Thrown at lib/fluent/plugin/output.rb:335
false
end
end
rescue => e
raise Fluent::ConfigError, "in chunk_keys: #{e.message}"
end
}
raise Fluent::ConfigError, "chunk_keys specification includes invalid char"
else
@chunk_key_accessors = Hash[@chunk_keys.map { |key| [key.to_sym, Fluent::PluginHelper::RecordAccessor::Accessor.new(key)] }]
end
if @chunk_key_time
raise Fluent::ConfigError, "<buffer ...> argument includes 'time', but timekey is not configured" unless @buffer_config.timekey
Fluent::Timezone.validate!(@buffer_config.timekey_zone)
@timekey_zone = @buffer_config.timekey_use_utc ? '+0000' : @buffer_config.timekey_zone
@timekey = @buffer_config.timekey
if @timekey <= 0
raise Fluent::ConfigError, "timekey should be greater than 0. current timekey: #{@timekey}"
end
@timekey_use_utc = @buffer_config.timekey_use_utc
@offset = Fluent::Timezone.utc_offset(@timekey_zone)
@calculate_offset = @offset.respond_to?(:call) ? @offset : nil
@output_time_formatter_cache = {}
end
if (@chunk_key_tag ? 1 : 0) + @chunk_keys.size >= CHUNKING_FIELD_WARN_NUM
log.warn "many chunk keys specified, and it may cause too many chunks on your system."
end
# no chunk keys or only tags (chunking can be done without iterating event stream)
@simple_chunking = !@chunk_key_time && @chunk_keys.empty?
@flush_mode = @buffer_config.flush_mode
if @flush_mode == :default
if has_flush_interval
log.info "'flush_interval' is configured at out side of <buffer>. 'flush_mode' is set to 'interval' to keep existing behaviour"View on GitHub (pinned to dd45c6e18d)
Solutions
- Set a positive window such as `timekey 5m`, `timekey 1h`, or `timekey 1d`
- If you do not want time chunking, remove `time` from the chunk keys instead of zeroing timekey
- Check env-substituted values actually resolve (e.g. `timekey #{ENV['FLUENT_TIMEKEY']}`)
Example fix
# before <buffer time> @type file timekey 0 </buffer> # after <buffer time> @type file timekey 1h </buffer>
Defensive patterns
Strategy: validation
Validate before calling
fluentd --dry-run -c /etc/fluent/fluent.conf
# if timekey comes from env: echo "timekey=#{ENV['FLUENT_TIMEKEY']}" and assert > 0 Prevention
- Never use timekey 0 to 'disable' chunking — remove the time key instead
- Assert env-substituted durations are positive before starting fluentd
- Reuse a small set of approved timekeys (5m/1h/1d)
When it happens
Trigger: `timekey 0` (sometimes written intending 'no window'), `timekey -300`, or a computed/env-substituted value that resolves to 0. Raised at output.rb:335-337 during configure.
Common situations: Attempting to disable time chunking by zeroing the key; using an environment variable (`timekey #{ENV['WINDOW']}`) that is empty and coerces to 0; copy/paste from an example with a placeholder value.
Related errors
- chunk_keys specification includes invalid char
- <buffer ...> argument includes 'time', but timekey is not co
- this plugin '#{self.class}' cannot handle arguments for <buf
- this plugin '#{self.class}' allows <buffer tag> only
- time_slice_format only with %Y or %m is too long
AI-assisted analysis of fluent/fluentd@dd45c6e18d (2026-08-21).
Data as JSON: /api/errors/83d33eaf5a214136.
Report an issue: GitHub.