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

[Feature Request] Random Wait functionality #428

Closed
bryaend opened this issue Nov 5, 2021 · 3 comments
Closed

[Feature Request] Random Wait functionality #428

bryaend opened this issue Nov 5, 2021 · 3 comments

Comments

@bryaend
Copy link

bryaend commented Nov 5, 2021

For environments with hundreds of VMs and large amounts of logging, it would be beneficial to have the option to run the logrotate at the same time (e.g., midnight) for all servers but allow them to pause for a random time (e.g., anywhere from 0 seconds to 6 hours, etc.) to more evenly distribute the processing load to compress so many files on so many servers. This would reduce nightly large CPU spikes across large clusters of hypervisors but still allow logs to be rotated at midnight sharp.

@kdudka
Copy link
Member

kdudka commented Nov 7, 2021

Do you trigger logrotate by the systemd timer? The AccuracySec=1h option in logrotate.timer does exactly this.

@cgzones
Copy link
Member

cgzones commented Nov 9, 2021

This seems to be a duplicate of #403.

See #403 (comment) for a suggested solution.

Another idea is to use postrotate and write the passed rotated filename to a file and compress all entries in this file with another timer in the desired timeframe.

@Zugschlus
Copy link

Do you trigger logrotate by the systemd timer? The AccuracySec=1h option in logrotate.timer does exactly this.

No, it doesn't. The requestor wants logrotate to wait a random time between actual log rotation (which causes next to no load) and the compression (which causes load). Your suggestion will also spread out the rotation, making it significantly harder to put logs taken around the rotation time on different machines side-by-side.

@kdudka kdudka closed this as completed Dec 2, 2022
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

No branches or pull requests

4 participants