-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
Automatically clean up old log files #2609
Comments
Not sure if the option has been suggested previously but the `logging` module has handlers that can rotate based on time and/or size, they might be suitable for an in-band solution to the problem (i.e. not needing to get an external check involved)
|
Sopel already uses |
That's why logrotate exists! We can document its usage for Sopel, the same way we document it to create a service with systemd. I don't like when a software tries to deal itself with logs, it tends to be messy and never really satisfactory. And on the dev side, it means we would have to deal with the maintenance burden of that. |
What's "messy and never really satisfactory" is defaulting to fill up the user's entire disk if left alone for long enough. If Sopel shouldn't delete its own old logs because you don't like when software tries to deal with that itself, why are you OK with Sopel creating its own log files for each day? Requiring the user to set up an external tool is not (IMO) in the spirit of being "simple". Recovering from a full disk also can be not "simple", depending on how Sopel was deployed. Sopel must clean up its own mess, or change to not create the mess in the first place. |
I strongly disagree with that. First, because That being said,
This removes log files older than 15 days every week. Can be customized easily to being monthly and older than 30 or 60 days. |
I can, begrudgingly, accept a config option to use TimedRotatingFileHandler's |
So my original suggestion from May, then? 😁
Not a terribly involved patch. Hardest part will be deciding what to call the new option ( |
Requested Feature
Sopel should clean up log files older than some default number of days, with a configuration option to override it.
Problems Solved
Our main Sopel instance started spitting out errors tonight when its jail ran out of disk quota. This feature would prevent similar issues from happening to other users who don't set up an external mechanism to prune logs.
Alternatives
As alluded to above, a
cron
job or other recurring task could take care of this—at the cost of extra effort from the bot owner.Notes
The
TimedRotatingFileHandler
'sbackupCount
option would be a simple way to implement this.The text was updated successfully, but these errors were encountered: