-
Notifications
You must be signed in to change notification settings - Fork 188
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
Add support for hourly logrotate #1043
Conversation
package com.hubspot.singularity.executor; | ||
|
||
public enum SingularityExecutorLogrotateFrequency { | ||
HOURLY("monthly"), |
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.
meant hourly here?
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.
meant to add a comment here -- hourly
isn't supported by all versions of logrotate. my intent was to make it run as infrequently as possible (hence monthly
) and then manually trigger logrotate by the executor. (open to other options if you have other ideas here)
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.
Right, forgot it doesn't actually have an hourly setting. Would it make sense to instead write something to /etc/cron.hourly/
? Value probably doesn't matter in either case since it's manually triggered. Then we could let cron do it's thing rather than having the executor worry about it. Just a thought, this way would work too.
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.
wouldn't it be far simpler if we made this functionality only work with versons of logrotate which support hourly?
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.
Should have clarified that comment, logrotate straight up doesn't support hourly (as far as I know). Most places suggest setting things up in cron.hourly or running a command/script manually if you need to rotate more than daily. From man pages:
Normally, logrotate is run as a daily cron job. It will not modify a
log multiple times in one day unless the criterium for that log is
based on the log’s size and logrotate is being run multiple times each
day, or unless the -f or -force option is used.
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.
The more I think about it, the more I think it'd be OK to go down the /etc/cron.hourly/
route. I'll update the PR.
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.
The puppet-logrotate module and newer versions of logrotate support hourly rotation.
We sometimes need to rotate more often than hourly and we create a manual entry in /etc/cron.d with the appropriate schedule and use the -f
option.
Updated PR use cron for hourly logrotate, confirmed working in the test cluster. |
0e65e6e
to
d56979c
Compare
Needed for verbose tasks where daily log rotation isn't often enough.