From owner-freebsd-questions@FreeBSD.ORG Fri Jul 9 16:02:17 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 76DA316A516 for ; Fri, 9 Jul 2004 16:02:17 +0000 (GMT) Received: from wildbean.clapper.org (wildbean.clapper.org [216.158.26.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 93B4643D39 for ; Fri, 9 Jul 2004 16:02:16 +0000 (GMT) (envelope-from bmc@clapper.org) Received: from condor.inside.clapper.org (phantom@condor.inside.clapper.org [172.16.87.5])i69G2EG7034532; Fri, 9 Jul 2004 12:02:14 -0400 (EDT) Received: from z.inside.clapper.org (z.inside.clapper.org [172.16.87.2]) i69G2EJZ005554; Fri, 9 Jul 2004 12:02:14 -0400 (EDT) Received: from z.inside.clapper.org (localhost [127.0.0.1]) i69G2CqH025657; Fri, 9 Jul 2004 12:02:13 -0400 (EDT) Message-Id: <200407091602.i69G2CqH025657@z.inside.clapper.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 9 Jul 2004 12:02:12 -0400 From: Brian Clapper To: freebsd-questions@freebsd.org In-Reply-To: <20040708224637.2c909d1b.wmoran@potentialtech.com> References: <002201c45111$801acb30$627ba8c0@phoenix> <20040613090822.GB75168@happy-idiot-talk.infracaninophile.co.uk> <003901c45197$9feda640$627ba8c0@phoenix> <20040616103837.GC3094@happy-idiot-talk.infracaninophile.co.uk> <002401c4655c$ecd47640$627ba8c0@phoenix> <20040708224637.2c909d1b.wmoran@potentialtech.com> X-Mailer: VM 7.17 under Emacs 21.3.1 X-Face: /perrud9r1.|7j.*=/6)a%vZ$^sBn!P[?+}vWBxd1ps{4hd2ZOw8]u&t';}(kj=x; JpdSF7 1b<*T{.38]wnWl]j/ULRB*49qdsET_/)-siUd7A_n- List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2004 16:02:18 -0000 On 8 July, 2004, at 22:46 (-0400) Bill Moran wrote: > "Graham North" wrote: > > > Hello all: > > > > There has to be a simple fix to this problem - I am using newsyslog and cron > > to rotate my Apache logfiles. They get rotated and Apache keeps working > > however after a log rotation takes place Apache will not longer log my > > accesses. It does continue to serve pages but I need to do an apachectl > > restart in order for it to continue logging properly. > > > > newsyslog.conf and crontab files are attached for reference. > > You need to restart apache to get it to start logging to a new file. Luckily, > newsyslog can do this for you. > > With the default Apache install, Apache will log its PID to a file when it > starts, just add this filename (/var/run/httpd.pid) to the end of each > newsyslog entry that rotates an apache file, and newsyslog will automatically > send a HUP signal to that PID when the log file is rotated > > See the man pages for newsyslog for more detailed info. Another option is to use the sysutils/cronolog port. Configure it in httpd.conf, with ErrorLog and CustomLog directives similar to the following: ---- ErrorLog "|/usr/local/sbin/cronolog --symlink=/var/log/httpd/error_log /var/log/httpd/error_log_%y%m%d" CustomLog "|/usr/local/sbin/cronolog --symlink=/var/log/httpd/access_log /var/log/httpd/access_log_%y%m%d" combined ---- cronolog will rotate logs automatically each day. From the cronlog man page: Before writing a message cronolog checks the time to see whether the current log file is still valid and if not it closes the current file, expands the template using the current date and time to generate a new file name, opens the new file (creating missing directories on the path of the new log file as needed unless the program is compiled with -DDONT_CREATE_SUBDIRS) and calculates the time at which the new file will become invalid. See the man page for further details. I've been using it for awhile on my public web server. Seems to work just fine. -Brian Brian Clapper, http://www.clapper.org/bmc/ Scott's first Law: No matter what goes wrong, it will probably look right.