ubuntu – Nginx continues to write to logrotate rotated file

I have Nginx running in Docker on Ubuntu 22.04

To rotate logs, I use Logrotate 3.19

After the upgrade from Ubuntu 20.04 to 22.04, Nginx stoped writing to new access.log after rotation. Manually running logrotate would run without errors and Nginx starts writing to new file.

I have no idea where to look for problem here. Nginx just writes 8Gb to access.log.1 until there is no space left on device.

Logrotate config file is default, not altered:

/var/log/nginx/*.log {
        daily
        missingok
        rotate 14
        compress
        delaycompress
        notifempty
        create 0640 www-data adm
        sharedscripts
        prerotate
                if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
                        run-parts /etc/logrotate.d/httpd-prerotate; \
                fi \
        endscript
        postrotate
                invoke-rc.d nginx rotate >/dev/null 2>&1
        endscript
}

Policy file has exit 0 in /usr/sbin/policy-rc.d

#!/bin/sh
exit 0

Read more here: Source link