{"record":{"id":"8a44ab00d7afed94","repo":"fluent/fluentd","slug":"time-slice-format-only-with-y-or-m-is-too-long","errorCode":null,"errorMessage":"time_slice_format only with %Y or %m is too long","messagePattern":"time_slice_format only with %Y or %m is too long","errorType":"exception","errorClass":"Fluent::ConfigError","httpStatus":null,"severity":"critical","filePath":"lib/fluent/compat/output.rb","lineNumber":667,"sourceCode":"            conf['localtime'] = \"false\"\n            conf.delete('utc')\n          elsif conf['localtime']\n            conf['timezone'] = Time.now.strftime('%z')\n            conf['localtime'] = \"true\"\n          else\n            # v0.12 assumes UTC without any configuration\n            # 'localtime=false && no timezone key' means UTC\n            conf['localtime'] = \"false\"\n          end\n\n          @_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                      when nil   then 86400 # default value of TimeSlicedOutput.time_slice_format is '%Y%m%d'\n                      else\n                        raise Fluent::ConfigError, \"time_slice_format only with %Y or %m is too long\"\n                      end\n          buf_params[\"timekey\"] = @_timekey\n\n          conf.elements << Fluent::Config::Element.new('buffer', 'time', buf_params, [])\n        end\n\n        ParserUtils.convert_parser_conf(conf)\n        FormatterUtils.convert_formatter_conf(conf)\n\n        super\n\n        if config_style == :v1\n          if @buffer_config.chunk_keys == ['tag']\n            raise Fluent::ConfigError, \"this plugin '#{self.class}' allows <buffer tag> only\"\n          end\n        end\n\n        self.extend TimeSliceChunkMixin","sourceCodeStart":649,"sourceCodeEnd":685,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/compat/output.rb#L649-L685","documentation":"Raised as Fluent::ConfigError in Fluent::Compat::TimeSlicedOutput#configure while translating a v0.12 time-sliced plugin's config. The shim maps time_slice_format to a v1 buffer timekey by scanning for %S (1s), %M (60s), %H (3600) or %d (86400); nil defaults to 86400. A format containing none of those - i.e. only %Y and/or %m such as '%Y%m' for monthly files - has no representable timekey and configure aborts.","triggerScenarios":"time_slice_format %Y%m (monthly) or %Y (yearly) on a v0.12 TimeSlicedOutput plugin such as legacy out_file/out_s3-style outputs; a migrated config that kept a coarse slice format.","commonSituations":"Trying to get monthly rolled files from old time-sliced plugins; copying v0.12 examples with %Y%m; generated configs that build the format string from a template.","solutions":["Use day-or-finer granularity: time_slice_format %Y%m%d (the default) or %Y%m%d%H","If month-level paths are required, switch to a v1 plugin and build paths with timekey/path placeholders, or post-process daily files","Validate the format contains %S/%M/%H/%d before deploy"],"exampleFix":"# before\ntime_slice_format %Y%m\n\n# after\ntime_slice_format %Y%m%d","handlingStrategy":"validation","validationCode":"fmt = conf['time_slice_format']\nvalid = fmt.nil? || fmt =~ /%[SMHd]/\nabort 'time_slice_format must include %S/%M/%H/%d (day-or-finer granularity)' unless valid","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember the granularity limit: time-sliced compat buffers cap at 86400s (one day)","Default %Y%m%d is almost always right; only add %H/%M/%S for finer slices","For month-level aggregation, slice daily and group downstream"],"tags":["fluentd","config","time-slice","v012-compat","buffer"],"backgroundTag":"invalid-time-format","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}