Quick question about using kill -USR1 to recreate access.log
Maxim Dounin
mdounin at mdounin.ru
Tue May 20 11:33:07 UTC 2014
Hello!
On Mon, May 19, 2014 at 03:06:06PM -0400, samingrassia wrote:
> Thanks to everyone in advance!
>
> I have a cron that runs the following:
>
> mv $NGINX_ACCESS_LOG $ACCESS_LOG_DROPBOX/$LOG_FILENAME
> kill -USR1 `cat $NGINX_PID`
>
> My questions is during time between the mv and the kill, is there any log
> writes that are being discarded or are they being stacked in memory and
> dumped into the new access.log after it is recreated?
Unless you are trying to move logs to a different filesystem,
logging will continue to the old file till USR1 is processed.
>From nginx point of view, the "mv" command does nothing - as nginx
has open file descriptor, it will continue to write to it, and log
lines will appear in the (old) file - the file which is now have a
new name. After USR1 nginx will reopen the log, and will continue
further logging to a new file.
--
Maxim Dounin
http://nginx.org/
More information about the nginx
mailing list