Date: Sun, 7 Jul 2002 13:22:04 +0200 (MET DST) From: Helge Oldach <helge.oldach@atosorigin.com> To: DougB@FreeBSD.ORG (Doug Barton) Cc: nunotex@pt-quorum.com, maxim@FreeBSD.ORG, freebsd-stable@FreeBSD.ORG Subject: Re: cvs commit: src/usr.sbin/newsyslog newsyslog.c Message-ID: <200207071122.NAA19022@galaxy.de.cp.philips.com> In-Reply-To: <3D27B7B2.1B8EEE9B@FreeBSD.org> from Doug Barton at "Jul 6, 2002 8:38:26 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207071122.NAA19022>
