Open dgw opened 1 month ago
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 TimedRotatingFileHandler
to get a new log file each day. It's just not configured to delete old logs, ever, so they build up indefinitely. Our main instance has had raw and debug logs turned on for a long time, which made it a problem much faster than it should ever impact normal use. 😁
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.