From owner-freebsd-stable Sun Jul 7 4:22:16 2002 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 79FC637B400; Sun, 7 Jul 2002 04:22:10 -0700 (PDT) Received: from mizar.origin-it.net (mizar.origin-it.net [194.8.96.234]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5AE0043E58; Sun, 7 Jul 2002 04:22:09 -0700 (PDT) (envelope-from Helge.Oldach@atosorigin.com) Received: from matar.hbg.de.int.atosorigin.com (firewall-user@dehsfw3e.origin-it.net [194.8.96.68]) by mizar.origin-it.net (8.12.5/8.12.5/hmo27jun02) with ESMTP id g67BM7DH078840 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Sun, 7 Jul 2002 13:22:07 +0200 (CEST) (envelope-from Helge.Oldach@atosorigin.com) Received: from galaxy.de.cp.philips.com (galaxy.de.cp.philips.com [130.143.166.29]) by matar.hbg.de.int.atosorigin.com (8.12.3/8.12.3/hmo06may02) with ESMTP id g67BM6Nr093502; Sun, 7 Jul 2002 13:22:06 +0200 (CEST) (envelope-from Helge.Oldach@atosorigin.com) Received: (from hmo@localhost) by galaxy.de.cp.philips.com (8.9.3/8.9.3/hmo01jul02) id NAA19022; Sun, 7 Jul 2002 13:22:05 +0200 (MET DST) Message-Id: <200207071122.NAA19022@galaxy.de.cp.philips.com> Subject: Re: cvs commit: src/usr.sbin/newsyslog newsyslog.c In-Reply-To: <3D27B7B2.1B8EEE9B@FreeBSD.org> from Doug Barton at "Jul 6, 2002 8:38:26 pm" To: DougB@FreeBSD.ORG (Doug Barton) Date: Sun, 7 Jul 2002 13:22:04 +0200 (MET DST) Cc: nunotex@pt-quorum.com, maxim@FreeBSD.ORG, freebsd-stable@FreeBSD.ORG From: Helge Oldach X-Address: Atos Origin GmbH, Billstrasse 80, D-20539 Hamburg, Germany X-Phone: +49 40 7886 464, Fax: +49 40 7886 235, Mobile: +49 160 4782517 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Doug Barton: >Nuno Teixeira wrote: > >> Does this mean that now I can use newsyslog to compress apache logs? > >The problem with newsyslog and things like apache and named is that the >process continues writing to the file after you mv it. The proper >procedure for such processes is: > >mv logfile logfile.old >hup process >(process creates and starts writing to new log) >compress logfile.old > >That way you don't lose anything. Since it's designed to work with >syslogd, what newsyslog does is: > >mv logfile logfile.old >(syslogd stops writing to logfile) >compress logfile.old >create logfile >hup syslogd Err, no, please cross-check with the source. Syslogd is handled no differently than other daemons. Newsyslog does: mv logfile logfile.old #daemon continues writing to logfile touch logfile hup daemon #daemon closes logfile.old, starts writing to logfile sleep 10 compress logfile.old Of course this works fine also with Apache and most other beasts. I also use it for huge Squid logfiles without trouble ("logfile_rotate 0"). There is a problem with multiple logfiles created by daemons, cf. the example in the original mail: /var/log/apache/httpd-error.log 640 3 3000 * B /var/run/httpd.pid 30 /var/log/apache/httpd-access.log 640 7 100000 * B /var/run/httpd.pid 30 This will cause newsyslog to send the signal *twice* to Apache, and Apache will restart *both* logfiles twice. Won't harm in most cases, but with a multitude of logfiles (e.g. one logfile per virtual host) this is obsolete overhead. See the patch in bin/20570 for a fix. Helge To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message