B.R.
May 20, 2014 06:52AM
On Tue, May 20, 2014 at 9:37 AM, Valentin V. Bartenev <vbart@nginx.com>wrote:

> Deleting a file doesn't make file descriptor "invalid". It's valid and the
> file actually exists on file system till there is at least one descriptor
> pointing to that file.
>

​Thanks for that Valentin, I learned something today.

I read
http://stackoverflow.com/questions/2028874/what-happens-to-an-open-file-handler-on-linux-if-the-pointed-file-gets-moved-de#2031100
As I understand it, all log messages going to a moved file​

​will still be printed into it.
So if I move /var/log/nginx/access.log to /foo/bar.log, all error log
message will continue to be printed in /foo/bar.log, until I send the USR1
signal to nginx (either master or workers), which will then close the file
descriptor (thus effectively delete /var/log/nginx/access.log which was
marked for deletion until then)​ and will create a new file in
/var/log/nginx/access.log
Am I right?
I suspect the file does not really move out of /var/log/nginx if at least
one fd is open on it. I suspect then that there is a symlink created in
/foo/bar.log pointing to the old file until it is effectively moved.

Does the same happens if the file is moved on a remote disk (ie does the
fact that a file is moved through copy+delete rather than rename have any
impact?)

---
*B. R.*
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Quick question about using kill -USR1 to recreate access.log

samingrassia May 19, 2014 03:06PM

Re: Quick question about using kill -USR1 to recreate access.log

Francis Daly May 19, 2014 03:38PM

Re: Quick question about using kill -USR1 to recreate access.log

Lord Nynex May 19, 2014 03:56PM

Re: Quick question about using kill -USR1 to recreate access.log

B.R. May 20, 2014 03:04AM

Re: Quick question about using kill -USR1 to recreate access.log

Valentin V. Bartenev May 20, 2014 03:38AM

Re: Quick question about using kill -USR1 to recreate access.log

B.R. May 20, 2014 06:52AM

Re: Quick question about using kill -USR1 to recreate access.log

Lasse Laursen May 20, 2014 03:54AM

Re: Quick question about using kill -USR1 to recreate access.log

Valentin V. Bartenev May 20, 2014 04:06AM

Re: Quick question about using kill -USR1 to recreate access.log

Maxim Dounin May 20, 2014 07:34AM

Re: Quick question about using kill -USR1 to recreate access.log

alder September 27, 2017 04:18PM

Re: Quick question about using kill -USR1 to recreate access.log

Maxim Dounin September 28, 2017 10:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 181
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