Bug 1803783
| Summary: | [RHEL/Bug] log rotation of rhsm.log not correctly handled | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Oliver Falk <ofalk> | |
| Component: | subscription-manager | Assignee: | Jiri Hnidek <jhnidek> | |
| Status: | CLOSED ERRATA | QA Contact: | Red Hat subscription-manager QE Team <rhsm-qe> | |
| Severity: | medium | Docs Contact: | ||
| Priority: | high | |||
| Version: | 7.6 | CC: | csnyder, jhnidek, jsefler, kagarwal, peter.vreman, redakkan, wpoteat | |
| Target Milestone: | rc | Keywords: | Triaged, ZStream | |
| Target Release: | --- | |||
| Hardware: | All | |||
| OS: | Linux | |||
| Whiteboard: | ||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | ||
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1827103 (view as bug list) | Environment: | ||
| Last Closed: | 2020-09-29 19:22:47 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: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1122832, 1827103 | |||
Verifying on :
[root@ibm-x3650m4-01-vm-08 rhsm]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.9.27-1
subscription management rules: 5.37
subscription-manager: 1.24.37
[root@ibm-x3650m4-01-vm-08 rhsm]# rpm -qa subscription-manager* --changelog | grep 1803783
- 1803783: Added copytruncate option to logrotate conf file; ENT-2114
- 1803783: Added copytruncate option to logrotate conf file; ENT-2114
- 1803783: Added copytruncate option to logrotate conf file; ENT-2114
[root@ibm-x3650m4-01-vm-08 rhsm]# cat /etc/logrotate.d/subscription-manager
/var/log/rhsm/*.log {
missingok
notifempty
sharedscripts
copytruncate
}
Make sure the services are running
[root@ibm-x3650m4-01-vm-08 rhsm]# ps -aux | grep rhsmd
root 21025 19.0 0.7 478180 28384 pts/1 Sl+ 08:05 0:00 /usr/bin/python /usr/libexec/rhsmd -k
root 21038 0.0 0.0 112808 936 pts/0 S+ 08:05 0:00 grep --color=auto rhsmd
[root@ibm-x3650m4-01-vm-08 rhsm]# ps -aux | grep virt-who
root 9934 0.0 0.7 819536 30032 ? Ssl 06:39 0:01 /usr/bin/python /usr/bin/virt-who
root 21040 0.0 0.0 112808 936 pts/0 S+ 08:05 0:00 grep --color=auto virt-who
Execute any subscription manager commands to generate new logs
[root@ibm-x3650m4-01-vm-08 rhsm]# subscription-manager attach --auto
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status: Subscribed
Execute logroate -f /etc/logrotate.conf
[root@ibm-x3650m4-01-vm-08 rhsm]# logrotate -f /etc/logrotate.conf
[root@ibm-x3650m4-01-vm-08 rhsm]# ll
total 16
-rw-r--r--. 1 root root 0 May 12 06:50 rhsmcertd.log
-rw-r--r--. 1 root root 491 May 12 06:50 rhsmcertd.log-20200512
-rw-r--r--. 1 root root 0 May 12 08:07 rhsm.log
-rw-r--r--. 1 root root 8416 May 12 08:07 rhsm.log-20200512
Delete the file rhsm.log-20200512
[root@ibm-x3650m4-01-vm-08 rhsm]# rm -rf rhsm.log-20200512
Notice that the service are still running
[root@ibm-x3650m4-01-vm-08 rhsm]# ps -aux | grep rhsmd
root 21025 0.2 0.8 564540 31104 pts/1 Sl+ 08:05 0:00 /usr/bin/python /usr/libexec/rhsmd -k
root 21119 0.0 0.0 112808 932 pts/0 S+ 08:08 0:00 grep --color=auto rhsmd
[root@ibm-x3650m4-01-vm-08 rhsm]# ps -aux | grep virt-who
root 9934 0.0 0.7 819536 30032 ? Ssl 06:39 0:01 /usr/bin/python /usr/bin/virt-who
root 21121 0.0 0.0 112808 936 pts/0 S+ 08:08 0:00 grep --color=auto virt-who
Lets the lsof results for rhsm file
[root@ibm-x3650m4-01-vm-08 rhsm]# lsof | grep deleted | grep rhsm*
[root@ibm-x3650m4-01-vm-08 rhsm]# lsof | grep deleted | grep rhsm
rhsmd 21025 root 6u REG 253,0 4096 100688378 /tmp/#100688378 (deleted)
[root@ibm-x3650m4-01-vm-08 rhsm]# ll
total 4
-rw-r--r--. 1 root root 0 May 12 06:50 rhsmcertd.log
-rw-r--r--. 1 root root 491 May 12 06:50 rhsmcertd.log-20200512
-rw-r--r--. 1 root root 0 May 12 08:07 rhsm.log
^^ Notice there are no reference to the deleted rhsm log file.
Based on the above observation moving the bug to verified
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 (subscription-manager bug fix 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-2020:3866 |
Description of problem: rhsm.log is rotated by '/etc/logrotate.d/subscription-manager'. However, this logrotate config doesn't correctly force the processes to reopen log files or otherwise take care about processes having opened the /var/log/rhsm/rhsm.log. Version-Release number of selected component (if applicable): 1.24.13 (but probably all other versions as well). How reproducible: Always Steps to Reproduce: 1. Have subscription-manager installed/running (rhsmd) 2. # logrotate -f /etc/logrotate.conf 3. # lsof | grep deleted | grep rhsm Actual results: # System w/ virt-who # lsof | grep deleted | grep rhsm rhsmd 1639 root 4w REG 253,0 17020466 52066240 /var/log/rhsm/rhsm.log-20200216 (deleted) rhsmd 1639 root 8u REG 253,11 4096 76 /tmp/ffi4TtlUS (deleted) virt-who 1964 root 6w REG 253,0 17020466 52066240 /var/log/rhsm/rhsm.log-20200216 (deleted) virt-who 1964 root 7w REG 253,0 17020466 52066240 /var/log/rhsm/rhsm.log-20200216 (deleted) virt-who 1964 root 9w REG 253,0 17020466 52066240 /var/log/rhsm/rhsm.log-20200216 (deleted) virt-who 1964 2473 root 6w REG 253,0 17020466 52066240 /var/log/rhsm/rhsm.log-20200216 (deleted) virt-who 1964 2473 root 7w REG 253,0 17020466 52066240 /var/log/rhsm/rhsm.log-20200216 (deleted) virt-who 1964 2473 root 9w REG 253,0 17020466 52066240 /var/log/rhsm/rhsm.log-20200216 (deleted) virt-who 1964 2481 root 6w REG 253,0 17020466 52066240 /var/log/rhsm/rhsm.log-20200216 (deleted) virt-who 1964 2481 root 7w REG 253,0 17020466 52066240 /var/log/rhsm/rhsm.log-20200216 (deleted) virt-who 1964 2481 root 9w REG 253,0 17020466 52066240 /var/log/rhsm/rhsm.log-20200216 (deleted) virt-who 1964 2483 root 6w REG 253,0 17020466 52066240 /var/log/rhsm/rhsm.log-20200216 (deleted) virt-who 1964 2483 root 7w REG 253,0 17020466 52066240 /var/log/rhsm/rhsm.log-20200216 (deleted) virt-who 1964 2483 root 9w REG 253,0 17020466 52066240 /var/log/rhsm/rhsm.log-20200216 (deleted) # System w/o virt-who # lsof | grep deleted | grep rhsm rhsmd 1167 root 4w REG 253,0 11598316 87353 /var/log/rhsm/rhsm.log-20200119 (deleted) rhsmd 1167 root 6u REG 253,5 4096 97 /tmp/ffiUFtUfE (deleted) gmain 1167 1270 root 4w REG 253,0 11598316 87353 /var/log/rhsm/rhsm.log-20200119 (deleted) Expected results: logrotate should handle the rotation of logfiles either in a way that the processes do not need to reopen the file handle (eg. copytruncate) or send the appropriate signal to the processes that have an open file handle. Additional info: Customer case will be linked.