-
Notifications
You must be signed in to change notification settings - Fork 518
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
filesize logrotate and log only specified level option #451
base: master
Are you sure you want to change the base?
Conversation
#1) * add support for rotating by file size and for logging only set level (global setting) * update README, coding style, fix rotate size
@@ -333,6 +333,8 @@ function isWritable(obj) { | |||
* See README.md for full details. | |||
* - `level`: set the level for a single output stream (cannot be used | |||
* with `streams`) | |||
* - `logOnlySetLevel`: Use level as the only level to log and not a | |||
* threshold (Defaut: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default
I've been hoping for file size based rotation for a while, hope this gets merged |
@@ -892,7 +892,8 @@ var log = bunyan.createLogger({ | |||
type: 'rotating-file', | |||
path: '/var/log/foo.log', | |||
period: '1d', // daily rotation | |||
count: 3 // keep 3 back copies | |||
count: 3, // keep 3 back copies, | |||
maxSizeKB: 1024 // rotate every 1024KB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should add a proper explanation of what the "maxSizeKB" attribute does.
If you expand the code below, you'll see:
"Currently, there is no support for providing a template for the rotated files, or for rotating when the log reaches a threshold size."
Which is no longer true.
@@ -333,6 +333,8 @@ function isWritable(obj) { | |||
* See README.md for full details. | |||
* - `level`: set the level for a single output stream (cannot be used | |||
* with `streams`) | |||
* - `logOnlySetLevel`: Use level as the only level to log and not a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't use any attribute "logOnlySetLevel".
Should it be "logOnlyMinLevel"?
@@ -892,7 +892,8 @@ var log = bunyan.createLogger({ | |||
type: 'rotating-file', | |||
path: '/var/log/foo.log', | |||
period: '1d', // daily rotation | |||
count: 3 // keep 3 back copies | |||
count: 3, // keep 3 back copies, | |||
maxSizeKB: 1024 // rotate every 1024KB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might also consider adding some instructions explaining how and where to set "logOnlyMinLevel" parameter.
I'm sorry if it's obvious and I didn't get it. :/
This PR adds support for log rotation with file size limitation additionally to the period of time rotation.
Also, add support to log only the specific log level (e.g: log only WARN), this is a global setting that will affect all streams.
Will create a patch in the future to add per stream support if will be required.