diff --git a/lib/fluent/command/fluentd.rb b/lib/fluent/command/fluentd.rb index e66285bf81..2f08689b07 100644 --- a/lib/fluent/command/fluentd.rb +++ b/lib/fluent/command/fluentd.rb @@ -85,9 +85,8 @@ opts[:log_path] = s } -ROTATE_AGE = %w(daily weekly monthly) op.on('--log-rotate-age AGE', 'generations to keep rotated log files') {|age| - if ROTATE_AGE.include?(age) + if Fluent::Log::LOG_ROTATE_AGE.include?(age) opts[:log_rotate_age] = age else begin diff --git a/lib/fluent/log.rb b/lib/fluent/log.rb index 4c096a615e..201b2d88a6 100644 --- a/lib/fluent/log.rb +++ b/lib/fluent/log.rb @@ -49,6 +49,7 @@ module TTYColor LOG_TYPE_DEFAULT = :default # show logs in all supervisor/workers, with worker id in workers (default) LOG_TYPES = [LOG_TYPE_SUPERVISOR, LOG_TYPE_WORKER0, LOG_TYPE_DEFAULT].freeze + LOG_ROTATE_AGE = %w(daily weekly monthly) def self.str_to_level(log_level_str) case log_level_str.downcase diff --git a/lib/fluent/system_config.rb b/lib/fluent/system_config.rb index 746268854c..b322b4bb60 100644 --- a/lib/fluent/system_config.rb +++ b/lib/fluent/system_config.rb @@ -56,7 +56,7 @@ class SystemConfig config_param :format, :enum, list: [:text, :json], default: :text config_param :time_format, :string, default: '%Y-%m-%d %H:%M:%S %z' config_param :rotate_age, default: nil do |v| - if %w(daily weekly monthly).include?(v) + if Fluent::Log::LOG_ROTATE_AGE.include?(v) v.to_sym else begin