0

I've a nginx reverse proxy with custom log files (depending on hostname)

pwd : /var/log/nginx/domain/fqdn.(log|err)

Since some time (maybe after switching to Ubuntu 23.10), my log files are very often empty.

Here is the logrotate config

root@rev-proxy:~# cat /etc/logrotate.d/nginx 
/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
}

After logrotate run, nginx can't log anymore to the differents log files until i reload / restart / force logrotate.

I've tried to replace invoke-rc.d nginx rotate >/dev/null 2>&1 with invoke-rc.d nginx reload >/dev/null 2>&1 but not working.

Last logs of last file are always between 00:00 and 00:15. So i think this is when logrotate is rotating the logs.

All log files have www-data:adm owner with 644 mask.

Does someone have an idea ?

Thank's

2
  • What happens if you run invoke-rc.d nginx rotate on the command line?
    – AlexD
    Commented Feb 26 at 9:24
  • logs work after manually reopening Commented Feb 28 at 15:15

1 Answer 1

0

Check that /var/log has execute permissions for "other" users.

Try replacing the postrotate.d command with

service nginx reload >/dev/null 2>&1
2
  • Yeah, mask is 775 Commented Feb 25 at 17:35
  • and already tried reload command, without success Commented Feb 28 at 15:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .