Welcome! Log In Create A New Profile

Advanced

Safe log rotation

October 01, 2014 05:30PM
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

2014-10-01T21:16:10+00:00,1412198170.957,10.120.71.11,"-","206.223.189.242",test-s.mysite.com,2486547,1,201,"-","-","-",-,"-","-","ApacheBench/2.3","-",HTTP/1.0,GET,http,/static/logo/test.png,"-",200,5676,5150,0.000,"-","-"
2014-10-01T21:16:10+00:00,1412198170.957,10.120.71.11,"-","206.223.189.242",test-s.mysite.com,2486548,1,240,"-","-","-",-,"-","-","ApacheBench/2.3","-",HTTP/1.0,GET,http,/static/logo/test.png,"-",200,5676,5150,0.000,"-","-"
2014-10-01T21:16:10+00:00,1412198170.958,10.120.71.11,"-","206.223.189.242",test-s.mysite.com,2486549,1,279,"-","-","-",-,"-","-","ApacheBench/2.3","-",HTTP/1.0,GET,http,/static/logo/test.png,"-",200,5676,5150,0.000,"-","-"
2014-10-01T21:16:10+00:00,1412198170.959,10.120.71.11,"-","206.223.189.242",test-s.mysite.com,2486550,1,318,"-","-","-",-,"-","-","ApacheBench/2.3","-",HTTP/1.0,GET,http,/static/logo/test.png,"-",200,5676,5150,0.000,"-","-"
2014-10-01T21:16:10+00:00,1412198170.964,10.120.71.11,"-","206.223.189.242",test-s.mysite.com,2486551,1,279,"-","-","-",-,"-","-","ApacheBench/2.3","-",HTTP/1.0,GET,http,/static/logo/test.png,"-",200,5676,5150,0.000,"-","-"

...

2014-10-01T21:16:27+00:00,1412198187.024,10.120.71.11,"-","206.223.189.242",test-s.mysite.com,2489854,1,162,"-","-","-",-,"-","-","ApacheBench/2.3","-",HTTP/1.0,GET,http,/static/logo/test.png,"-",200,5676,5150,0.000,"-","-"
2014-10-01T21:16:27+00:00,1412198187.024,10.120.71.11,"-","206.223.189.242",test-s.mysite.com,2489855,1,162,"-","-","-",-,"-","-","ApacheBench/2.3","-",HTTP/1.0,GET,http,/static/logo/test.png,"-",200,5676,5150,0.000,"-","-"
2014-10-01T21:16:27+00:00,1412198187.024,10.120.71.11,"-","206.223.189.242",test-s.mysite.com,2489856,1,162,"-","-","-",-,"-","-","ApacheBench/2.3","-",HTTP/1.0,GET,http,/static/logo/test.png,"-",200,5676,5150,0.000,"-","-"
2014-10-01T21:16:27+00:00,1412198187.024,10.120.71.11,"-","206.223.189.242",test-s.mysite.com,2489857,1,240,"-","-","-",-,"-","-","ApacheBench/2.3","-",HTTP/1.0,GET,http,/static/logo/test.png,"-",200,5676,5150,0.000,"-","-"
2014-10-01T21:16:27+00:00,1412198187.024,10.120.71.11,"-","206.223.189.242",test-s.mysite.com,2489858,1,279,"-","-","-",-,"-","-","ApacheBench/2.3","-",HTTP/1.0,GET,http,/static/logo/test.png,"-",200,5676,5150,0.000,"-","-"

As you can see, there is a gap in timestamps sequence.
Is there a way to make sure all log-lines are going to be written on a highly loaded web farm?

Thank you,
Roman Naumenko
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: 148
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