Skip to content

Commit

Permalink
Fix for rotate_age where Fluentd passes as Symbol (#4311)
Browse files Browse the repository at this point in the history
Fix for rotate_age where Fluentd passes as Symbol while Ruby Logger expects String

---------

Signed-off-by: mrudrego <[email protected]>
Signed-off-by: mrudrego <[email protected]>
  • Loading branch information
mrudrego authored Oct 18, 2023
1 parent fcbcb56 commit dd1a6e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/fluent/system_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class SystemConfig
config_param :time_format, :string, default: '%Y-%m-%d %H:%M:%S %z'
config_param :rotate_age, default: nil do |v|
if Fluent::Log::LOG_ROTATE_AGE.include?(v)
v.to_sym
v
else
begin
Integer(v)
Expand Down
4 changes: 2 additions & 2 deletions test/config/test_system_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def parse_text(text)
data('daily' => "daily",
'weekly' => 'weekly',
'monthly' => 'monthly')
test "symbols for rotate_age" do |age|
test "strings for rotate_age" do |age|
conf = parse_text(<<-EOS)
<system>
<log>
Expand All @@ -160,7 +160,7 @@ def parse_text(text)
</system>
EOS
sc = Fluent::SystemConfig.new(conf)
assert_equal(age.to_sym, sc.log.rotate_age)
assert_equal(age, sc.log.rotate_age)
end

test "numeric number for rotate age" do
Expand Down

0 comments on commit dd1a6e5

Please sign in to comment.