fluent/fluentd · error · Fluent::ConfigError
both of utc and localtime are specified, use only one of the
Error message
both of utc and localtime are specified, use only one of them
What it means
While converting legacy v0.12 buffer parameters, compat_parameters_buffer rejects configs that set both localtime and utc at the top level of a time-sliced output (compat_parameters.rb:160-162). The two options answer the same question (which clock generates the time slice?) with contradictory answers, and the v0.14 model has a single timekey_use_utc flag, so the conversion cannot proceed and a Fluent::ConfigError is raised.
Source
Thrown at lib/fluent/plugin_helper/compat_parameters.rb:162
value
end
end
chunk_key = default_chunk_key
if conf.has_key?('time_slice_format')
chunk_key = 'time'
hash['timekey'] = case conf['time_slice_format']
when /\%S/ then 1
when /\%M/ then 60
when /\%H/ then 3600
when /\%d/ then 86400
else
raise Fluent::ConfigError, "time_slice_format only with %Y or %m is too long"
end
if conf.has_key?('localtime') || conf.has_key?('utc')
if conf.has_key?('localtime') && conf.has_key?('utc')
raise Fluent::ConfigError, "both of utc and localtime are specified, use only one of them"
elsif conf.has_key?('localtime')
hash['timekey_use_utc'] = !(Fluent::Config.bool_value(conf['localtime']))
elsif conf.has_key?('utc')
hash['timekey_use_utc'] = Fluent::Config.bool_value(conf['utc'])
end
end
else
if chunk_key == 'time'
hash['timekey'] = 86400 # TimeSliceOutput.time_slice_format default value is '%Y%m%d'
end
end
e = Fluent::Config::Element.new('buffer', chunk_key, hash, [])
conf.elements << e
conf
end
View on GitHub (pinned to dd45c6e18d)
Solutions
- Delete one of the two keys — keep utc true for UTC slicing or localtime true/false for local time
- Move to native v0.14 syntax: <buffer time> timekey_use_utc true </buffer> instead of legacy localtime/utc
- If a timezone other than UTC/local is wanted, use timezone (mapped to timekey_zone) rather than combining utc and localtime
- Audit generated/templated fluentd configs for snippets that hardcode both options
Example fix
# before <match app.**> @type old_timesliced_output time_slice_format %Y%m%d utc true localtime true </match> # => both of utc and localtime are specified, use only one of them # after <match app.**> @type old_timesliced_output time_slice_format %Y%m%d utc true </match>
Defensive patterns
Strategy: validation
Validate before calling
raise 'config sets both localtime and utc' if conf.has_key?('localtime') && conf.has_key?('utc') # buffer-compat section
Try / catch
begin
plugin.configure(conf)
rescue Fluent::ConfigError => e
if e.message.include?('both of utc and localtime')
abort 'remove utc or localtime from the buffer config (keep exactly one clock option)'
end
raise
end Prevention
- Adopt a style rule: one clock option per plugin block — utc, localtime, or timezone, never two
- Migrate time-sliced outputs to <buffer time> with timekey_use_utc/timekey_zone to make the setting explicit
- Dry-run templated configs in CI; this error is deterministic and caught pre-deploy
When it happens
Trigger: A plugin calling compat_parameters_convert(conf, :buffer) whose config contains both time_slice_format-era 'localtime true' and 'utc true' lines (any values — presence alone triggers it). Raised during configure at startup.
Common situations: Config templates that include utc true by default and an operator adding localtime for local files; merges of config snippets from different sources keeping both keys; v0.12 configs that silently favored one key now failing loudly under the compat converter.
Related errors
- time_slice_format only with %Y or %m is too long
- Plugin @id or path for <storage> required when 'persistent'
- Plugin storage path '#{@path}' is not readable/writable
- Invalid contents (not object) in plugin storage file: '#{@pa
- Unexpected error: failed to read data from plugin storage fi
AI-assisted analysis of fluent/fluentd@dd45c6e18d (2026-08-21).
Data as JSON: /api/errors/d1a497018ef66c14.
Report an issue: GitHub.