Don't modify logrotate default config file #145

Open
opened 2022-01-31 11:27:29 +01:00 by bwaegeneire · 0 comments
Owner

The tasks in evolinux-base/tasks/logs.yml modify /etc/logrotate.conf which is owned by the logrotate package, so when the package change it's default configuration we don't get the new default configuration. And worse, not having the default config stop the logroate service as some directive may be out of sync with other configuration files in /etc/logrotate.d.

For exemple, previously /etc/logroate.conf contained the following snnipet:

/var/log/wtmp {
    missingok
    monthly
    create 0664 root utmp
    rotate 12
}

Snippet which was later moved to /etc/logrotate.d/wtmp and removed from /etc/logroate.conf. In our cas the part removing it from /etc/logroate.conf wasn't applied since we customized this file, so we end up with a duplicated snippet present in both /etc/logrotate.conf and /etc/logrotate.d/wtmp which blocked logrotate from running because of the duplcate entry for /var/log/wtmp.

To fix that I suggest we put our default global configuration (such as rotate 12) in a sperate file like zz-evolix-defaults or aa-evolix-defaults. ATM it's not clear to me the order in which lograte directive are interpreted¹ as we want to set default global configuration options which apply to every other local confiugration.

¹ https://www.mankier.com/8/logrotate#Configuration_File

The tasks in `evolinux-base/tasks/logs.yml` modify `/etc/logrotate.conf` which is owned by the `logrotate` package, so when the package change it's default configuration we don't get the new default configuration. And worse, not having the default config stop the logroate service as some directive may be out of sync with other configuration files in `/etc/logrotate.d`. For exemple, previously `/etc/logroate.conf` contained the following snnipet: ``` conf /var/log/wtmp { missingok monthly create 0664 root utmp rotate 12 } ``` Snippet which was later moved to `/etc/logrotate.d/wtmp` and removed from `/etc/logroate.conf`. In our cas the part removing it from `/etc/logroate.conf` wasn't applied since we customized this file, so we end up with a duplicated snippet present in both `/etc/logrotate.conf` and `/etc/logrotate.d/wtmp` which blocked logrotate from running because of the duplcate entry for `/var/log/wtmp`. To fix that I suggest we put our default global configuration (such as `rotate 12`) in a sperate file like `zz-evolix-defaults` or `aa-evolix-defaults`. ATM it's not clear to me the order in which lograte directive are interpreted¹ as we want to set default global configuration options which apply to every other local confiugration. ¹ https://www.mankier.com/8/logrotate#Configuration_File
bwaegeneire added this to the Debian 12 (Bookworm) milestone 2022-01-31 11:30:37 +01:00
Sign in to join this conversation.
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: evolix/ansible-roles#145
No description provided.