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

Enable log rotation for Fluent::Log #1231

Closed
ganmacs opened this issue Sep 13, 2016 · 6 comments · Fixed by #1235
Closed

Enable log rotation for Fluent::Log #1231

ganmacs opened this issue Sep 13, 2016 · 6 comments · Fixed by #1235
Labels
feature request *Deprecated Label* Use enhancement label in general v0.14

Comments

@ganmacs
Copy link
Member

ganmacs commented Sep 13, 2016

As the log file increases, it becomes difficult to handle the log file.
So, I want to enable the log rotation for Fluent::Log to keep log files down to a manageable size.

I'll add these command line arguments to fluentd command.

  • --log-rotate-age

The number of old log files to keep, or frequency of rotation (daily, weekly or monthly). The default value is 5. it is used when you set a value to --log-rotate-size and don't set a value to --log-rotate-age.If you set 0 as a value of --log-rotate-age, the logger will do no log rotation.

  • --log-rotate-size

Maximum logfile size (only applies when log-rotate-age is a number). The default value is 1M.
it is used when you set a value to --log-rotate-age and don't set a value to --log-rotate-size.

@tagomoris
Copy link
Member

What happens when --log-rotate-age is 0?

@tagomoris tagomoris added feature request *Deprecated Label* Use enhancement label in general v0.14 labels Sep 13, 2016
@ganmacs
Copy link
Member Author

ganmacs commented Sep 13, 2016

log-rotate-age means "the number of old log files to keep".
When --log-rotate-age is 0, old log files are not created.

@tagomoris
Copy link
Member

@ganmacs What does it mean? Which one?:

  • log file will be rotated, but old log will disappear immediately
  • log file will not be rotated

@ganmacs
Copy link
Member Author

ganmacs commented Sep 14, 2016

log file will not be rotated

This one.

Fluent::Logclass uses ServerEngine::DaemonLogger class inside and ServerEngine::DaemonLogger extends Ruby's Logger class.
This is a design by ruby's Logger class( https://github.com/ruby/ruby/blob/7b2d47132ff8ee950b0f978ab772dee868d9f1b0/lib/logger.rb#L769 )

@tagomoris
Copy link
Member

I meant that we should tell users that the default value of --log-rotate-age=0 means "no log rotation" clearly.

@ganmacs
Copy link
Member Author

ganmacs commented Sep 14, 2016

I added a description about the case of --log-rotate-age=0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request *Deprecated Label* Use enhancement label in general v0.14
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants