Nginx logfile rotation

Am trying to configure for logfile rotation using logrotate with nginx
(0.7.61). As the logrotate script runs, the old logfile is renamed and
a
new one is created, but nginx still writes to the old (renamed) logfile
even
with open_log_file_cache set to off according to
http://wiki.nginx.org/NginxHttpLogModule#open_log_file_cache

Is there anything that I’m missing out?

Ray.

Ray wrote:

Am trying to configure for logfile rotation using logrotate with nginx
(0.7.61). As the logrotate script runs, the old logfile is renamed
and a new one is created, but nginx still writes to the old (renamed)
logfile even with open_log_file_cache set to off according to
http://wiki.nginx.org/NginxHttpLogModule#open_log_file_cache

Is there anything that I’m missing out?

Ray.
kill -USR1 cat /path/to/nginx.pid

Is there any way other than killing/restarting the nginx processes? Am
asking this because it seemed to me that nginx shouldn’t need to be
restarted for it to use the new log file, if I didn’t read the wiki
wrongly.

Ray.

it not restarted.

see this: http://wiki.nginx.org/NginxCoreModule#pid

Ray wrote:

Is there any way other than killing/restarting the nginx processes?
Am asking this because it seemed to me that nginx shouldn’t need to be
restarted for it to use the new log file, if I didn’t read the wiki
wrongly.
The “kill” command doesn’t kill the process. It merely sends a signal to
it, in this case “USR1” which re-opens the log file.

See
http://wiki.nginx.org/NginxCommandLine#Controlling_Nginx_Via_the_Signals
.

    logfile is renamed and a new one is created, but nginx still

Jim

Wow I never knew that could be done with nginx! Thanks a lot 立冰 and Jim
for
your help, learnt a lot.

I never came upon http://wiki.nginx.org/NginxCommandLine before by
browsing
through the wiki, where exactly is it linked from?

Ray.

Ray wrote:

Wow I never knew that could be done with nginx! Thanks a lot 立冰 and
Jim for your help, learnt a lot.

I never came upon http://wiki.nginx.org/NginxCommandLine before by
browsing through the wiki, where exactly is it linked from?

I’m not sure what pages link to it from within the Wiki. Maybe Cliff
Wells can answer that. I knew I’d find it quickly by googling “nginx
signals”.

The default signal for “kill” is TERM (at least it is in Linux and I
believe in FreeBSD as well) so by default it kills the process but there
are other signals that do not kill the process.

    if I didn't read the wiki wrongly.

    still


Jim

Jim

On Tue, 2009-09-01 at 11:35 +0800, Ray wrote:

Wow I never knew that could be done with nginx! Thanks a lot 立冰 and
Jim for your help, learnt a lot.

I never came upon http://wiki.nginx.org/NginxCommandLine before by
browsing through the wiki, where exactly is it linked from?

It’s linked from

http://wiki.nginx.org/NginxGettingStarted

near the bottom of the page.

Cliff

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs