Bug 2070623
| Summary: | Move back to logrotate copytruncate method | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Jan Friesse <jfriesse> | ||||
| Component: | corosync | Assignee: | Jan Friesse <jfriesse> | ||||
| Status: | CLOSED ERRATA | QA Contact: | cluster-qe <cluster-qe> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | CentOS Stream | CC: | bstinson, ccaulfie, cluster-maint, jwboyer, phagara | ||||
| Target Milestone: | rc | Keywords: | Triaged | ||||
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | corosync-3.1.5-4.el9 | Doc Type: | If docs needed, set a value | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2022-11-15 10:25:11 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
|
Description
Jan Friesse
2022-03-31 15:02:49 UTC
Created attachment 1869741 [details]
logrotate: Use copytruncate method by default
logrotate: Use copytruncate method by default
The reopen lograte method has two main problems:
1. It does fail when corosync is not running (solvable by
adding "|| true")
2. If (for some reason, like SELinux) cfgtool -L fails, logrotate
fails and corosync keeps logging into old file. Added "|| true"
makes situation even worse because logrotate removes file but
corosync keeps logging into it.
Solution is to install copytruncate logrotate snip by default (and
keep reopen config file only for reference).
Signed-off-by: Jan Friesse <jfriesse>
Reviewed-by: Christine Caulfield <ccaulfie>
before fix ========== > [root@virt-537 ~]# rpm -q corosync > corosync-3.1.5-3.el9.x86_64 > [root@virt-537 ~]# cat /etc/logrotate.d/corosync > /var/log/cluster/corosync.log { > missingok > compress > daily > rotate 31 > minsize 2048 > notifempty > nocreate > postrotate > /usr/sbin/corosync-cfgtool -L > endscript > } 1) logrotate while corosync is not running > [root@virt-537 ~]# systemctl status corosync > ○ corosync.service - Corosync Cluster Engine > Loaded: loaded (/usr/lib/systemd/system/corosync.service; disabled; vendor preset: disabled) > Active: inactive (dead) > Docs: man:corosync > man:corosync.conf > man:corosync_overview > > Jul 02 13:58:20 virt-537.cluster-qe.lab.eng.brq.redhat.com corosync[54549]: Ringbuffer: > Jul 02 13:58:20 virt-537.cluster-qe.lab.eng.brq.redhat.com corosync[54549]: ->OVERWRITE > Jul 02 13:58:20 virt-537.cluster-qe.lab.eng.brq.redhat.com corosync[54549]: ->write_pt [50056] > Jul 02 13:58:20 virt-537.cluster-qe.lab.eng.brq.redhat.com corosync[54549]: ->read_pt [0] > Jul 02 13:58:20 virt-537.cluster-qe.lab.eng.brq.redhat.com corosync[54549]: ->size [2098176 words] > Jul 02 13:58:20 virt-537.cluster-qe.lab.eng.brq.redhat.com corosync[54549]: =>free [8192476 bytes] > Jul 02 13:58:20 virt-537.cluster-qe.lab.eng.brq.redhat.com corosync[54549]: =>used [200224 bytes] > Jul 02 13:58:20 virt-537.cluster-qe.lab.eng.brq.redhat.com systemd[1]: corosync.service: Deactivated successfully. > Jul 02 13:58:20 virt-537.cluster-qe.lab.eng.brq.redhat.com systemd[1]: Stopped Corosync Cluster Engine. > Jul 02 13:58:20 virt-537.cluster-qe.lab.eng.brq.redhat.com systemd[1]: corosync.service: Consumed 3.380s CPU time. > [root@virt-537 ~]# wc -l /var/log/cluster/corosync.log > 59 /var/log/cluster/corosync.log > [root@virt-537 ~]# logrotate --force /etc/logrotate.d/corosync > Could not initialize corosync configuration API error CS_ERR_LIBRARY > error: error running non-shared postrotate script for /var/log/cluster/corosync.log of '/var/log/cluster/corosync.log ' result: logrotate fails 2) logrotate with non-working corosync-cfgtool > [root@virt-537 ~]# chmod -x $(which corosync-cfgtool) > [root@virt-537 ~]# systemctl start corosync > [root@virt-537 ~]# wc -l /var/log/cluster/corosync.log > 44 /var/log/cluster/corosync.log > [root@virt-537 ~]# logrotate --force /etc/logrotate.d/corosync > logrotate_script: line 2: /usr/sbin/corosync-cfgtool: Permission denied > error: error running non-shared postrotate script for /var/log/cluster/corosync.log of '/var/log/cluster/corosync.log ' result: logrotate fails after fix ========= > [root@virt-491 ~]# rpm -q corosync > corosync-3.1.5-4.el9.x86_64 > [root@virt-491 ~]# cat /etc/logrotate.d/corosync > /var/log/cluster/corosync.log { > missingok > compress > copytruncate > daily > rotate 31 > minsize 2048 > notifempty > } 1) logrotate while corosync is not running > [root@virt-491 ~]# systemctl status corosync > ○ corosync.service - Corosync Cluster Engine > Loaded: loaded (/usr/lib/systemd/system/corosync.service; disabled; vendor preset: disabled) > Active: inactive (dead) > Docs: man:corosync > man:corosync.conf > man:corosync_overview > > Jul 02 10:55:28 virt-491.cluster-qe.lab.eng.brq.redhat.com corosync[55387]: Ringbuffer: > Jul 02 10:55:28 virt-491.cluster-qe.lab.eng.brq.redhat.com corosync[55387]: ->OVERWRITE > Jul 02 10:55:28 virt-491.cluster-qe.lab.eng.brq.redhat.com corosync[55387]: ->write_pt [50285] > Jul 02 10:55:28 virt-491.cluster-qe.lab.eng.brq.redhat.com corosync[55387]: ->read_pt [0] > Jul 02 10:55:28 virt-491.cluster-qe.lab.eng.brq.redhat.com corosync[55387]: ->size [2098176 words] > Jul 02 10:55:28 virt-491.cluster-qe.lab.eng.brq.redhat.com corosync[55387]: =>free [8191560 bytes] > Jul 02 10:55:28 virt-491.cluster-qe.lab.eng.brq.redhat.com corosync[55387]: =>used [201140 bytes] > Jul 02 10:55:28 virt-491.cluster-qe.lab.eng.brq.redhat.com systemd[1]: corosync.service: Deactivated successfully. > Jul 02 10:55:28 virt-491.cluster-qe.lab.eng.brq.redhat.com systemd[1]: Stopped Corosync Cluster Engine. > Jul 02 10:55:28 virt-491.cluster-qe.lab.eng.brq.redhat.com systemd[1]: corosync.service: Consumed 19min 3.341s CPU time. > [root@virt-491 ~]# wc -l /var/log/cluster/corosync.log > 15 /var/log/cluster/corosync.log > [root@virt-491 ~]# logrotate --force /etc/logrotate.d/corosync > [root@virt-491 ~]# wc -l /var/log/cluster/corosync.log > 0 /var/log/cluster/corosync.log > [root@virt-491 ~]# cat /var/log/cluster/corosync.log.1.gz | gzip -d - | wc -l > 15 result: logs successfully rotated with corosync not running 2) logrotate with non-working corosync-cfgtool > [root@virt-491 ~]# chmod -x $(which corosync-cfgtool) > [root@virt-491 ~]# systemctl start corosync > [root@virt-491 ~]# wc -l /var/log/cluster/corosync.log > 34 /var/log/cluster/corosync.log > [root@virt-491 ~]# logrotate --force /etc/logrotate.d/corosync > [root@virt-491 ~]# wc -l /var/log/cluster/corosync.log > 0 /var/log/cluster/corosync.log > [root@virt-491 ~]# cat /var/log/cluster/corosync.log.1.gz | gzip -d - | wc -l > 34 result: fixed logrotate config does not require corosync-cfgtool, log file rotation succeeds Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (corosync bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2022:8127 |