Skip to content

Add support for hourly logrotate#1043

Merged
tpetr merged 2 commits into
masterfrom
logrotate-interval
Jun 9, 2016
Merged

Add support for hourly logrotate#1043
tpetr merged 2 commits into
masterfrom
logrotate-interval

Conversation

@tpetr

@tpetr tpetr commented May 18, 2016

Copy link
Copy Markdown
Contributor

Needed for verbose tasks where daily log rotation isn't often enough.

package com.hubspot.singularity.executor;

public enum SingularityExecutorLogrotateFrequency {
HOURLY("monthly"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meant hourly here?

Copy link
Copy Markdown
Contributor Author

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)

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown

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.

@ssalinas ssalinas modified the milestone: 0.8.0 May 19, 2016
@tpetr

tpetr commented May 19, 2016

Copy link
Copy Markdown
Contributor Author

Updated PR use cron for hourly logrotate, confirmed working in the test cluster.

@tpetr tpetr added the hs_qa label May 19, 2016
@ssalinas ssalinas force-pushed the logrotate-interval branch from 0e65e6e to d56979c Compare May 20, 2016 13:28
@tpetr tpetr added hs_qa and removed hs_qa labels Jun 9, 2016
@tpetr tpetr merged commit 0478f3b into master Jun 9, 2016
@tpetr tpetr removed hs_qa labels Jun 9, 2016
@ssalinas ssalinas deleted the logrotate-interval branch September 12, 2016 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants