Date: Fri, 18 Jul 2008 13:24:58 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Zbigniew Szalbot <z.szalbot@lcwords.com> Cc: freebsd-questions@freebsd.org Subject: Re: log size handling Message-ID: <48808B9A.8000008@infracaninophile.co.uk> In-Reply-To: <48808246.10301@lcwords.com> References: <487F2525.3030304@lcwords.com> <20080717072023.4b9e1d2f.wmoran@potentialtech.com> <487F2D9B.2010407@lcwords.com> <200807170904.26354.mario.lobo@ipad.com.br> <487F52EE.2050907@infracaninophile.co.uk> <4880748D.8030902@lcwords.com> <48807DC8.1050007@infracaninophile.co.uk> <48808246.10301@lcwords.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig224F257D81493B74E444954F Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Zbigniew Szalbot wrote: > Hello, >=20 > Matthew Seaman: >=20 >> Correct. Although you may want to add '30' as the 8th field -- that=20 >> means >> 'send signal 30 (SIGUSR1) to apache instead of SIGHUP' -- SIGUSR1 caus= es >> apache to do a graceful restart rather than abruptly killing and=20 >> restarting >> everything: http://httpd.apache.org/docs/2.2/stopping.html >> >> You'll need to experiment though -- if your user HTTP connections are = >> long-lived, you can end up with apache appending data to a rotated=20 >> logfile >> that it still has an open file descriptor on. The file will be unlink= ed >> once the gzip compression has run. Now, writing to an unlinked file i= s >> allowed under Unix, but once that apache child process terminates and = >> releases the descriptor the data will disappear into the ether, so y= ou >> can lose log entries. >=20 > Thank you very much Matthew! Just one final question. When the apache=20 > child process finally terminates, will apache start logging to a new=20 > log? Or will it be writing into the ether until it gets restarted? >=20 > Thanks again! I appreciate your help. >=20 The restart process with apache is that all the child processes are shutdown -- either straight away (for a plain restart) or once they've finished their current bit of work (fora graceful restart). As the child process shuts down, it closes all the file descriptors used for logging. Ultimately the master process will respawn itself -- in the event of a gr= aceful restart this may occur before all of the old child processes have closed down. I'm not sure if the master process actually logs anyth= ing much, but even if it doesn't this will similarly close and then reopen all file descriptors. The renewed master process then starts up a whole new set of child processes, each of which will open up new logging connections. Now, if logging direct to a file, apache will open the file by name. As newsyslog has just moved away the old file and created a new file with the appropriate name, this means that all log output from the new apache processes will go into the new log file. Which is what you want. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enig224F257D81493B74E444954F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAkiAi6AACgkQ8Mjk52CukIz3HQCfZsi02muh/aKQnaZ1HiAQb8b3 wiYAoJHmlRv9hlliYTmE2N6iNiaIItou =Is6l -----END PGP SIGNATURE----- --------------enig224F257D81493B74E444954F--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48808B9A.8000008>