about log rotation

Chieu lfchieu at gmail.com
Tue Jun 23 06:46:08 MSD 2009


understand it. And thank you.

2009/6/22 Igor Sysoev <is at rambler-co.ru>

> On Mon, Jun 22, 2009 at 03:18:44PM +0800, Chieu wrote:
>
> > hi,all
> > I found the way of the log rotation is below. And during the period
> between
> > "mv" and "kill",  some logs will be lost because of the file doesn't
> exist
> > any more.
> > Is there any good ways?
> >
> > thanks
> >
> > <
> http://wiki.nginx.org/index.php?title=NginxLogRotation&action=edit&section=1
> >
> >
> > nginx will re-open it's logs in response to the USR1 signal.
> >
> > $ mv access.log access.log.0
> > $ kill -USR1 <code>cat master.nginx.pid</code>
> > $ sleep 1
> > $ gzip access.log.0    # do something with access.log.0
>
> No, the data will not be lost. Until a worker process keeps a file open
> the worker is able to write to the file even the file was renamed or
> deleted.
> This is true for both Unix and Win32 (although in Win32 in you can not
> delete
> an open files, you can just to rename them).
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090623/0b9f323a/attachment.html>


More information about the nginx mailing list