Describe the bug
If you enable log rotation and don't specify the log path, then Fluentd fails to start.
- Windows only
- Since v1.16.0
nil check for @log_path to be passed to Fluent::Log.per_process_path() is missing:
|
rotate = @log_rotate_age || @log_rotate_size |
|
actual_log_path = @log_path |
|
|
|
# We need to prepare a unique path for each worker since Windows locks files. |
|
if Fluent.windows? && rotate |
|
actual_log_path = Fluent::Log.per_process_path(@log_path, process_type, worker_id) |
|
end |
|
|
|
if actual_log_path && actual_log_path != "-" |
|
FileUtils.mkdir_p(File.dirname(actual_log_path)) unless File.exist?(actual_log_path) |
To Reproduce
Launch Fluentd with the config below, which enables rotation.
$ bundle exec fluentd -c fluent.conf
#=> The error below occurs.
If you specify the log path, this issue doesn't occur.
$ bundle exec fluentd -c fluent.conf -o fluent.log
#=> Fluentd starts correctly.
If the config doesn't have rotation options, this issue doesn't occur either.
Expected behavior
If rotation is enabled but the log file path is not specified,
the rotation setting is ignored, and Fluentd normally starts with output to standard output as before v1.16.0.
Your Environment
- Fluentd version: 1.16.1
- Operating system: Windows Home 10
- Kernel version: 3.1.7-340.x86_64
Your Configuration
<system>
<log>
rotate_age 5
</log>
</system>
<source>
@type sample
tag test
</source>
<match test.**>
@type stdout
</match>
Your Error Log
C:/Users/reang/Documents/work/fluentd/fluentd/lib/fluent/log.rb:77:in `initialize': no implicit conversion of nil into String (TypeError)
path = Pathname(path)
^^^^
from C:/Users/reang/Documents/work/fluentd/fluentd/lib/fluent/log.rb:77:in `Pathname'
from C:/Users/reang/Documents/work/fluentd/fluentd/lib/fluent/log.rb:77:in `per_process_path'
from C:/Users/reang/Documents/work/fluentd/fluentd/lib/fluent/supervisor.rb:701:in `setup_global_logger'
from C:/Users/reang/Documents/work/fluentd/fluentd/lib/fluent/supervisor.rb:624:in `configure'
from C:/Users/reang/Documents/work/fluentd/fluentd/lib/fluent/command/fluentd.rb:351:in `<top (required)>'
from <internal:C:/Ruby32-x64/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from <internal:C:/Ruby32-x64/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from C:/Users/reang/Documents/work/fluentd/fluentd/bin/fluentd:15:in `<top (required)>'
from C:/Ruby32-x64/lib/ruby/gems/3.2.0/bin/fluentd:25:in `load'
from C:/Ruby32-x64/lib/ruby/gems/3.2.0/bin/fluentd:25:in `<main>'
Additional context
No response
Describe the bug
If you enable log rotation and don't specify the log path, then Fluentd fails to start.
nilcheck for@log_pathto be passed toFluent::Log.per_process_path()is missing:fluentd/lib/fluent/supervisor.rb
Lines 696 to 705 in dc7e4b2
To Reproduce
Launch Fluentd with the config below, which enables rotation.
If you specify the log path, this issue doesn't occur.
If the config doesn't have rotation options, this issue doesn't occur either.
Expected behavior
If rotation is enabled but the log file path is not specified,
the rotation setting is ignored, and Fluentd normally starts with output to standard output as before v1.16.0.
Your Environment
Your Configuration
<system> <log> rotate_age 5 </log> </system> <source> @type sample tag test </source> <match test.**> @type stdout </match>Your Error Log
Additional context
No response