Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: log-rotate setting by config file does not work correctly #3921

Closed
daipom opened this issue Oct 18, 2022 · 0 comments · Fixed by #3939
Closed

Windows: log-rotate setting by config file does not work correctly #3921

daipom opened this issue Oct 18, 2022 · 0 comments · Fixed by #3939
Assignees
Labels

Comments

@daipom
Copy link
Contributor

daipom commented Oct 18, 2022

Describe the bug

https://docs.fluentd.org/deployment/logging#log-rotation-setting

NOTE: When --log-rotate-age is specified on Windows, log files are separated into log-supervisor-0.log, log-0.log, ..., log-N.log where N is generation - 1 due to the system limitation. Windows does not permit delete and rename files simultaneously owned by another process.

NOTE: When --log-rotate-size is specified on Windows, log files are separated into log-supervisor-0.log, log-0.log, ..., log-N.log where N is generation - 1 due to the system limitation. Windows does not permit delete and rename files simultaneously owned by another process.

As this document says, If rotation is enabled, each process must output a different log file on Windows.

However, when using log-rotate setting of system directive, the supervisor process outputs its log to log-0.log, not log-supervisor-0.log.

When using command line options such as --log-rotate-age, the following code in command/fluentd.rb fixes the path for the supervisor.

This process seems to be missing for log-rotate setting of system directive.

To Reproduce

Just run the fluentd with the following environment and the following config.

> bundle exec fluentd -c fluentd.conf -o fluentd.log

Expected behavior

First, the following two files are created.

  • fluentd-0.log
  • fluentd-supervisor-0.log

Then, they will be rotated without an error.

Your Environment

- Fluentd version: 1.15.2
- TD Agent version:
- Operating system: Windows 10
- Kernel version:

Your Configuration

<system>
  <log>
    rotate_age 5
    rotate_size 2000
  </log>
</system>

<source>
  @type sample
  tag test.log
  rate 100
  dummy {"message": "This is the test message"}
</source>

<match test.**>
  @type stdout
</match>

Your Error Log

Immediately the following error begins to output to the console.

> bundle exec fluentd -c fluentd.conf -o fluentd.log
log shifting failed. Permission denied @ rb_file_s_rename - (.\fluent\fluentd-0.log, .\fluent\fluentd-0.log.0)
log writing failed. closed stream
log shifting failed. closed stream
...

Additional context

When using command line options, this problem does not occur.

> bundle exec fluentd -c fluentd.conf -o fluentd.log --log-rotate-age 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants