def generate_path_template(original, timekey, append, compress, path_suffix: '', time_slice_format: nil)
      comp_suffix = compression_suffix(compress)
      index_placeholder = append ? '' : '_**'
      if original.index('*')
        raise "BUG: configuration error must be raised for path including '*' without timekey" unless timekey
        time_placeholders_part = time_slice_format || timekey_to_timeformat(timekey)
        original.gsub('*', time_placeholders_part + index_placeholder) + comp_suffix
      else
        if timekey
          if time_slice_format
            "#{original}.#{time_slice_format}#{index_placeholder}#{path_suffix}#{comp_suffix}"
          else
            time_placeholders = timekey_to_timeformat(timekey)
            if time_placeholders.scan(/../).any?{|ph| original.include?(ph) }
              raise Fluent::ConfigError, "insufficient timestamp placeholders in path" if time_placeholders.scan(/../).any?{|ph| !original.include?(ph) }
              "#{original}#{index_placeholder}#{path_suffix}#{comp_suffix}"
            else
              "#{original}.#{time_placeholders}#{index_placeholder}#{path_suffix}#{comp_suffix}"
            end
          end
        else
          "#{original}#{index_placeholder}#{path_suffix}#{comp_suffix}"
        end
      end
    end
def generate_path_template(original, timekey, append, compress, path_suffix: '', time_slice_format: nil)
      comp_suffix = compression_suffix(compress)
      index_placeholder = append ? '' : '_**'
      if original.index('*')
        raise "BUG: configuration error must be raised for path including '*' without timekey" unless timekey
        time_placeholders_part = time_slice_format || timekey_to_timeformat(timekey)
        original.gsub('*', time_placeholders_part + index_placeholder) + comp_suffix
      else
        if timekey
          if time_slice_format
            "#{original}.#{time_slice_format}#{index_placeholder}#{path_suffix}#{comp_suffix}"
          else
            time_placeholders = timekey_to_timeformat(timekey)
            if time_placeholders.scan(/../).any?{|ph| original.include?(ph) }
              raise Fluent::ConfigError, "insufficient timestamp placeholders in path" if time_placeholders.scan(/../).any?{|ph| !original.include?(ph) }
              "#{original}#{index_placeholder}#{path_suffix}#{comp_suffix}"
            else
              "#{original}.#{time_placeholders}#{index_placeholder}#{path_suffix}#{comp_suffix}"
            end
          end
        else
          "#{original}#{index_placeholder}#{path_suffix}#{comp_suffix}"
        end
      end
    end
/path/to/dir/file.*      -> /path/to/dir/file.%Y%m%d
 /path/to/dir/file.*.data -> /path/to/dir/file.%Y%m%d.data
 /path/to/dir/file        -> /path/to/dir/file.%Y%m%d.log
   %Y%m%d -> %Y%m%d_** (non append)
 + .gz (gzipped)
 TODO: remove time_slice_format when end of support of compat_parameters