I have a twisted server that generates log files and rotates them based on size. If the file size of a particular file is more than 1MB, a new log file is created.
However, after several days of running, the log files start filling up my hard disk.
Is there a way to have an overall limit on log rotation? The limit could be based on total size (like only 200GB worth of logs - anything more would be deleted), or on the number of files (like only 1000 logs would be stored).
You can use the option logger. You will have to write your own logger factory, something like this
Then while running the server you can specify the option logger as