Date: Wed, 2 Jul 2003 17:04:29 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Jim Xochellis <dxoch@escape.gr> Cc: freebsd-questions@freebsd.org Subject: Re: About newsyslog behavior Message-ID: <20030702160429.GA18780@happy-idiot-talk.infracaninophile.co.uk> In-Reply-To: <B9EF983C-AC8B-11D7-A8D3-003065C4E486@escape.gr> References: <20030702110158.GA39403@happy-idiot-talk.infracaninophile.co.uk> <B9EF983C-AC8B-11D7-A8D3-003065C4E486@escape.gr>
next in thread | previous in thread | raw e-mail | index | archive | help
--fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 02, 2003 at 03:50:15PM +0300, Jim Xochellis wrote: [ Dealing with processes that keep an open file descriptor on their log files, and that don't understand the use of SIGHUP to reopen the file] > 1) Many servers (netatalk, samba, apache, etc) are creating many=20 > processes which are all using the same log files. Hence, these servers=20 > have already solved the above problems somehow. I know very little about netatalk, but of the other two packages you mention: apache understands the HUP signal and will do a restart, including reopening its log files as desired. Even better, it understands the USR1 signal (signal 30) as a "graceful restart" -- that means that apache child processes that are actually serving out a request at the time of the signal will be permitted to finish before closing down. See: http://httpd.apache.org/docs/stopping.html You can use a line like this in /etc/newsyslog.conf to cycle the httpd-access.log. You'll need similar lines for httpd-error.log, ssl_engine_log, ssl_request_log or any other log file your httpd generates. /var/log/httpd-access.log 644 20 100 * Z /var/run/httpd.pid 30 samba can also generate a lot of log files depending on configuration. However, it also can be configured to put out all of it's logging information via syslog(3). Samba is also capable of recycling it's own log files. See the 'max log size' entry in smb.conf: http://samba.mirror.ac.uk/samba/docs/man/smb.conf.5.html#MAXLOGSIZE > 2) When implementing logging we are always flushing the log file *very*= =20 > frequently and I believe that this fact is reducing the possibility of=20 > facing the above problems. Yes -- a well behaved process will certainly not assume that it is the only process that can write to any particular file. The worse programs in this respect are those where the log output is simply the result of redirecting the stdout/stderr of the program. Jakarta Tomcat is pretty bad in that respect. > 3) I have done some tests my self and had no problems at all. (Of=20 > course that is not a proof, just an indication...) [...] =20 > I am thinking about changing the newsyslog instead (adding an option)=20 > but I am such a newbie in Unix, makefiles and all this stuff (except c)= =20 Go for it. The ideal would probably be to add another flag to the 'flags' column to go with the BCGJNUWZ- flags it already understands, so that you can apply the 'file descriptor friendly' method of updating on a per-file basis. Unless you're going to be adding whole new files to the newsyslog sources, then you shouldn't need to modify any Makefiles at all. Once you're happy with your modifications, you can submit them back to the project for review and maybe eventual adoption by using send-pr. Don't forget to update the man page as well. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --fUYQa+Pmc3FrFX/N Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQE/AwKMdtESqEQa7a0RAlVWAJ45zoehGQ1Z47DaGAnZZky3iksEpACfcHFD fi2g/WyOhsZk4jgd6tUbnWw= =vCI3 -----END PGP SIGNATURE----- --fUYQa+Pmc3FrFX/N--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030702160429.GA18780>