Modern Linux Systems have a mechanism called logrotate to rotate different log files.
The general configuration file is located under /etc/logrotate.conf and specific changes are under /etc/logrotate.d/
By default the logrotate job is started once a day by a O/S cron.daily job: /etc/cron.daily/logrotate
Because the default log rotation configuration does not exactly what I want I have adapted it a bit:
First I need a database user for log rotation:
CREATE USER 'logrotate'@'localhost' IDENTIFIED BY 'secret'; …