{"record":{"id":"d1a497018ef66c14","repo":"fluent/fluentd","slug":"both-of-utc-and-localtime-are-specified-use-only-d1a497","errorCode":null,"errorMessage":"both of utc and localtime are specified, use only one of them","messagePattern":"both of utc and localtime are specified, use only one of them","errorType":"exception","errorClass":"Fluent::ConfigError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin_helper/compat_parameters.rb","lineNumber":162,"sourceCode":"            value\n          end\n        end\n\n        chunk_key = default_chunk_key\n\n        if conf.has_key?('time_slice_format')\n          chunk_key = 'time'\n          hash['timekey'] = case conf['time_slice_format']\n                            when /\\%S/ then 1\n                            when /\\%M/ then 60\n                            when /\\%H/ then 3600\n                            when /\\%d/ then 86400\n                            else\n                              raise Fluent::ConfigError, \"time_slice_format only with %Y or %m is too long\"\n                            end\n          if conf.has_key?('localtime') || conf.has_key?('utc')\n            if conf.has_key?('localtime') && conf.has_key?('utc')\n              raise Fluent::ConfigError, \"both of utc and localtime are specified, use only one of them\"\n            elsif conf.has_key?('localtime')\n              hash['timekey_use_utc'] = !(Fluent::Config.bool_value(conf['localtime']))\n            elsif conf.has_key?('utc')\n              hash['timekey_use_utc'] = Fluent::Config.bool_value(conf['utc'])\n            end\n          end\n        else\n          if chunk_key == 'time'\n            hash['timekey'] = 86400 # TimeSliceOutput.time_slice_format default value is '%Y%m%d'\n          end\n        end\n\n        e = Fluent::Config::Element.new('buffer', chunk_key, hash, [])\n        conf.elements << e\n\n        conf\n      end\n","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin_helper/compat_parameters.rb#L144-L180","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\n<match app.**>\n  @type old_timesliced_output\n  time_slice_format %Y%m%d\n  utc true\n  localtime true\n</match>\n# => both of utc and localtime are specified, use only one of them\n\n# after\n<match app.**>\n  @type old_timesliced_output\n  time_slice_format %Y%m%d\n  utc true\n</match>","handlingStrategy":"validation","validationCode":"raise 'config sets both localtime and utc' if conf.has_key?('localtime') && conf.has_key?('utc') # buffer-compat section\n","typeGuard":null,"tryCatchPattern":"begin\n  plugin.configure(conf)\nrescue Fluent::ConfigError => e\n  if e.message.include?('both of utc and localtime')\n    abort 'remove utc or localtime from the buffer config (keep exactly one clock option)'\n  end\n  raise\nend","preventionTips":["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"],"tags":["fluentd","buffer","compat","v012-migration","timezone","config-error","startup"],"backgroundTag":"conflicting-config-options","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}