Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
DescriptionDarius Sagatauskas
2022-05-16 11:45:28 UTC
Description of problem:
After nginx log rotate there is no writing to access.log and error.log
How reproducible:
/bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
Actual results:
no writes to /var/log/nginx/access.log and /var/log/nginx/error.log
Expected results:
start logging to /var/log/nginx/access.log and /var/log/nginx/error.log
Additional info:
inside nginx-1.20.1-10.el9.x86_64.rpm packet `/var/log/nginx` directory has 700 permissions,
needed execute flags for example 711 permissions
For example nginx-1.21.6-1.module_el8+13729+1f4c91e7.x86_64 from CentOS Stream 8 epel-modular repo has permissions:
ls -ld /var/log/nginx/
drwx--x--x. 2 root root 4096 May 16 03:06 /var/log/nginx/
Comment 2Stephen John Smoogen
2022-11-08 20:31:15 UTC
The problem comes down to the patches which are in the EL8 module stream
https://git.centos.org/rpms/nginx/blob/c8-stream-1.20/f/SPECS/nginx.spec#_490
and are in the Fedora code
```
f0de5036 (Felix Kaechele 2021-06-01 13:28:30 -0400 547) %attr(711,root,root) %dir %{_localstatedir}/log/nginx
f0de5036 (Felix Kaechele 2021-06-01 13:28:30 -0400 548) %ghost %attr(640,%{nginx_user},root) %{_localstatedir}/log/nginx/access.log
f0de5036 (Felix Kaechele 2021-06-01 13:28:30 -0400 549) %ghost %attr(640,%{nginx_user},root) %{_localstatedir}/log/nginx/error.log
```
but the EL9 code seems to be different:
```
8e7aa8c8 (Lubos Uhliarik 2021-04-26 15:42:27 +0000 552) %dir %{_localstatedir}/log/nginx
```
The lack of the files and directories being owned or set to the correct permissions stops logrotate from being able to succeed in rotating the data.
Oddly, the logrotate gzip does somehow force the issue, so while the USR1 signal fails to rotate the logs, gzipping and deleting the rotated log does force nginx to move on somehow, so this is likely why this hasn't been as catastrophic as a broken logrotate for nginx could have been.
Example of how this manifests on a Alma9 box:
```
sudo ls -l /var/log/nginx/
total 3695860
-rw-r--r--. 1 nginx root 0 Oct 17 00:00 access.log
-rw-r--r--. 1 nginx root 800448 Aug 18 08:32 access.log-20220818.gz
-rw-r--r--. 1 nginx root 1893953 Aug 19 09:13 access.log-20220819.gz
-rw-r--r--. 1 nginx root 11871298 Aug 24 11:41 access.log-20220820.gz
-rw-r--r--. 1 nginx root 27833831 Aug 30 10:53 access.log-20220825.gz
-rw-r--r--. 1 nginx root 224302243 Oct 4 12:14 access.log-20220831.gz
-rw-r--r--. 1 nginx root 57698494 Oct 11 08:43 access.log-20221005.gz
-rw-r--r--. 1 nginx root 30176181 Oct 16 01:46 access.log-20221012.gz
-rw-r--r--. 1 nginx root 2582539598 Nov 8 11:42 access.log-20221017
-rw-r--r--. 1 nginx root 0 Oct 17 00:00 error.log
-rw-r--r--. 1 root root 148 Aug 5 15:55 error.log-20220807.gz
-rw-r--r--. 1 root root 187 Aug 12 12:10 error.log-20220816.gz
-rw-r--r--. 1 root root 71954 Aug 18 08:31 error.log-20220817.gz
-rw-r--r--. 1 nginx root 139441 Aug 19 09:12 error.log-20220819.gz
-rw-r--r--. 1 nginx root 2200171 Aug 24 11:41 error.log-20220820.gz
-rw-r--r--. 1 nginx root 3674864 Aug 30 10:32 error.log-20220825.gz
-rw-r--r--. 1 nginx root 18854248 Oct 4 12:13 error.log-20220831.gz
-rw-r--r--. 1 nginx root 4249185 Oct 11 08:43 error.log-20221005.gz
-rw-r--r--. 1 nginx root 2172337 Oct 16 01:44 error.log-20221012.gz
-rw-r--r--. 1 nginx root 309927134 Nov 8 11:42 error.log-20221017
```
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 (nginx 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-2023:2358