Nginx stop logging

Frank Swasey frank.swasey at gmail.com
Sun Sep 4 17:30:03 UTC 2022


You should verify that /run/nginx.pid actually exists and contains the PID
of the master nginx process on your Rocky Linux system.

I think that adding the "create 0640 nginx root" line to the logrotate
config file would not help.  You can issue the "kill -USR1 <PID>" where you
replace "<PID>" with the PID of the running nginx process and it SHOULD
create a new log file.

~ Frank

On Sun, Sep 4, 2022 at 9:46 AM Vincent M. <mouseless at free.fr> wrote:

> On my Rocky Linux 9, I have found this file /etc/logrotate.d/nginx
> /var/log/nginx/*log {
>     daily
>     rotate 10
>     missingok
>     notifempty
>     compress
>     delaycompress
>     sharedscripts
>     postrotate
>         /bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null ||
> true
>     endscript
> }
>
> Whereas I have on my Fedora 36 (with a working fine log rotation process):
> /var/log/nginx/*.log {
>     create 0640 nginx root
>     daily
>     rotate 10
>     missingok
>     notifempty
>     compress
>     delaycompress
>     sharedscripts
>     postrotate
>         /bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null ||
> true
>     endscript
> }
>
> Can I had on (create 0640 nginx root) on the server whitout risking to
> break everything on next logs rotates?
> Thank you,
> Vincent.
>
> On 9/4/22 14:17, Frank Swasey wrote:
>
> This sounds like your log rotation process is not signalling nginx to
> write a new log.  I don't know Rocky Linux, so I can't be specific in
> further suggestions.
>
>  ~ Frank
>
> On Sun, Sep 4, 2022 at 7:24 AM Vincent M. <mouseless at free.fr> wrote:
>
>> Hello,
>>
>> The logs are working fine but once a day, nginx stop loging access and
>> then the file log file is empty.
>>
>> So every day I have to restart my nginx server in order to get the logs.
>>
>> It's on a Rocky Linux 9 with Nginx 1.20.1
>>
>> Never seen that before, what should I check?
>>
>> Thanks,
>> Vincent.
>> _______________________________________________
>> nginx mailing list -- nginx at nginx.org
>> To unsubscribe send an email to nginx-leave at nginx.org
>>
>
>
> --
> I am not young enough to know everything. - Oscar Wilde (1854-1900)
>
> _______________________________________________
> nginx mailing list -- nginx at nginx.org
> To unsubscribe send an email to nginx-leave at nginx.org
>
>
> _______________________________________________
> nginx mailing list -- nginx at nginx.org
> To unsubscribe send an email to nginx-leave at nginx.org
>


-- 
I am not young enough to know everything. - Oscar Wilde (1854-1900)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20220904/eda9d6f3/attachment.htm>


More information about the nginx mailing list