Welcome! Log In Create A New Profile

Advanced

Re: Safe log rotation

oscaretu .
October 02, 2014 03:10AM
I think you should remove the line:

sleep 15

It doesnt' anything useful, It just delay the restart, so during 15 seconds
the request will end been registered in the old log file

mv /mnt/vg0-lv0/access.log /mnt/vg0-lv0/access.log.OLD
sudo kill -USR1 `cat /var/run/nginx.pid`
sleep 2
head -n 5 /mnt/vg0-lv0/access.log

If I would do this in a interactive way, I'd prefer

mv /mnt/vg0-lv0/access.log /mnt/vg0-lv0/access.log.OLD
sudo kill -USR1 `cat /var/run/nginx.pid`
sleep 2
tail -f /mnt/vg0-lv0/access.log

because I see the log request in real time



On Thu, Oct 2, 2014 at 8:39 AM, Igor Sysoev <igor@sysoev.ru> wrote:

>
> On 02 Oct 2014, at 01:30, jmobile <nginx-forum@nginx.us> wrote:
>
> > Hi,
> >
> > I'd like to check how nginx handles command from
> > http://wiki.nginx.org/LogRotation
> > kill -USR1 `cat /var/run/nginx.pid`
> >
> > I'm using it to recreate log files during rotation.
> >
> > My question if any loglines can be lost in case time interval between
> > physical log files rotation and USR1 is large enough, like seconds? Or if
> > load is very high.
> >
> > For example, while I was sending traffic to website with "ab -n 20 -c 10
> > http://test-s.mysite.com/static/99$i/logo/test.png > /dev/null 2>&1" in
> the
> > loop, I executed on the web-server this
> >
> > tail -n 5 /mnt/vg0-lv0/access.log
> > rm -rf /mnt/vg0-lv0/access.log
> > sleep 15; sudo kill -USR1 `cat /var/run/nginx.pid`
> > sleep 2
> > head -n 5 /mnt/vg0-lv0/dj-access.log
>
> This is not log rotation but log removal. Try this:
>
> mv /mnt/vg0-lv0/access.log /mnt/vg0-lv0/access.log.OLD
> sleep 15;
> sudo kill -USR1 `cat /var/run/nginx.pid`
> sleep 2
> head -n 5 /mnt/vg0-lv0/access.log
>
>
> --
> Igor Sysoev
> Join us for nginx.conf 2014, October 20-22, San Francisco.
> Get 25% off with code NGINXUG: http://nginx.com/nginxconf/
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>



--
Oscar Fernandez Sierra
oscaretu@gmail.com
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Safe log rotation

jmobile October 01, 2014 05:30PM

Re: Safe log rotation

Igor Sysoev October 02, 2014 02:40AM

Re: Safe log rotation

oscaretu . October 02, 2014 03:10AM

Re: Safe log rotation

Igor Sysoev October 02, 2014 03:26AM

Re: Safe log rotation

jmobile October 02, 2014 05:31PM

Re: Safe log rotation

Igor Sysoev October 03, 2014 12:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 283
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready