logrotate broken if the "log-archive" group doesn't exist

Bug #1949803 reported by Junien F
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Container Log Archive Charm
Fix Released
High
Haw Loeung

Bug Description

Hi,

The charm installs the following logrotate file :

/var/log/container-log-archive.log {
    rotate 7
    daily
    dateext
    compress
    notifempty
    missingok
    create 0664 root log-archive
}

The "log-archive" group is hardcoded. But on a lot of machines (e.g. cloud mirrors) it doesn't exist, so logrotate fails with :

/etc/cron.daily/logrotate:
error: container-log-archive:11 unknown group 'log-archive'
error: found error in /var/log/container-log-archive.log , skipping

and the file isn't rotated.

We know this group can possibly not exist on the machine as per https://code.launchpad.net/~hloeung/container-log-archive-charm/+git/container-log-archive-charm/+merge/389938 but it looks like we missed the logrotate config. I guess the fix here is to check if the group exists, and if it doesn't, just use root.

Thanks !

Related branches

Revision history for this message
Haw Loeung (hloeung) wrote (last edit ):

Should be a matter of converting the logrotate file used to a template and then passing through the right group - 'log-archive' if it exists and 'root' if not (basically what Junien said).

Changed in container-log-archive-charm:
status: New → Confirmed
importance: Undecided → High
Haw Loeung (hloeung)
Changed in container-log-archive-charm:
status: Confirmed → In Progress
assignee: nobody → Haw Loeung (hloeung)
Revision history for this message
Haw Loeung (hloeung) wrote :
Haw Loeung (hloeung)
Changed in container-log-archive-charm:
status: In Progress → Fix Committed
Haw Loeung (hloeung)
Changed in container-log-archive-charm:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.