<div dir="ltr"><div><div>I think you should  remove the line:<br><br></div>sleep 15<br><br></div>It doesnt' anything useful, It just delay the restart, so during 15 seconds the request will end been registered in the old log file<br><div><br>mv /mnt/vg0-lv0/access.log /mnt/vg0-lv0/access.log.OLD<br>
sudo kill -USR1 `cat /var/run/nginx.pid`<br>
sleep 2<br>
head -n 5 /mnt/vg0-lv0/access.log<br><br>If I would do this in a interactive way, I'd prefer<br><br>mv /mnt/vg0-lv0/access.log /mnt/vg0-lv0/access.log.OLD<br>
sudo kill -USR1 `cat /var/run/nginx.pid`<br>sleep 2<br>tail -f  /mnt/vg0-lv0/access.log<br></div><div><br></div><div>because I see the log request in real time<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 2, 2014 at 8:39 AM, Igor Sysoev <span dir="ltr"><<a href="mailto:igor@sysoev.ru" target="_blank">igor@sysoev.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On 02 Oct 2014, at 01:30, jmobile <<a href="mailto:nginx-forum@nginx.us">nginx-forum@nginx.us</a>> wrote:<br>
<br>
> Hi,<br>
><br>
> I'd like to check how nginx handles command from<br>
> <a href="http://wiki.nginx.org/LogRotation" target="_blank">http://wiki.nginx.org/LogRotation</a><br>
> kill -USR1 `cat /var/run/nginx.pid`<br>
><br>
> I'm using it to recreate log files during rotation.<br>
><br>
> My question if any loglines can be lost in case time interval between<br>
> physical log files rotation and USR1 is large enough, like seconds? Or if<br>
> load is very high.<br>
><br>
> For example, while I was sending traffic to website with "ab -n 20 -c 10<br>
> <a href="http://test-s.mysite.com/static/99$i/logo/test.png" target="_blank">http://test-s.mysite.com/static/99$i/logo/test.png</a> > /dev/null 2>&1" in the<br>
> loop, I executed on the web-server this<br>
><br>
> tail -n 5 /mnt/vg0-lv0/access.log<br>
> rm -rf /mnt/vg0-lv0/access.log<br>
> sleep 15; sudo kill -USR1 `cat /var/run/nginx.pid`<br>
> sleep 2<br>
> head -n 5 /mnt/vg0-lv0/dj-access.log<br>
<br>
This is not log rotation but log removal. Try this:<br>
<br>
mv /mnt/vg0-lv0/access.log /mnt/vg0-lv0/access.log.OLD<br>
sleep 15;<br>
sudo kill -USR1 `cat /var/run/nginx.pid`<br>
sleep 2<br>
head -n 5 /mnt/vg0-lv0/access.log<br>
<span class=""><font color="#888888"><br>
<br>
--<br>
Igor Sysoev<br>
Join us for nginx.conf 2014, October 20-22, San Francisco.<br>
Get 25% off with code NGINXUG: <a href="http://nginx.com/nginxconf/" target="_blank">http://nginx.com/nginxconf/</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>Oscar Fernandez Sierra<br><a href="mailto:oscaretu@gmail.com">oscaretu@gmail.com</a>
</div></div>