Various Debian packages, including logrotate and rsyslog, put their own log rotation definitions in /etc/logrotate.d/
What is the correct way to override those definitions?
If I modify the files, I get warnings at every system update and I risk losing the changes if I (or someone else) give the wrong answer; or risk not getting new upstream definitions for new log files if I (or someone else) fail to merge the files by hand. Both things have happened regularly in the past few years.
I tried overriding the definition in 00_* or zz_* files, but I get a duplicate error:
error: zz_mail:1 duplicate log entry for /var/log/mail.log
error: found error in /var/log/mail.log , skipping
Is there any clean solution? Should I write a cron script to re-apply my changes to the definition files every day?
Edit: to be more clear, ideally I would like to keep 99% of rsyslog's log rotation definitions in place, and automatically updated with APT. Except for a single definition, that of /var/log/mail.log, for which I need to apply a different rotation policy.
If Logrotate allowed duplicate definitions, and only used the first or the last one for each file, my problem would be solved. If it had an override option, to flag a definition as overriding a previous one on purpose, that would also solve it.
But alas, it seems I need to override the entire /etc/logrotate.d/rsyslog (and nginx, and others) with my own versions.