From owner-freebsd-questions@FreeBSD.ORG Wed Feb 28 16:13:09 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 18BA016A403 for ; Wed, 28 Feb 2007 16:13:09 +0000 (UTC) (envelope-from david.robillard@gmail.com) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.229]) by mx1.freebsd.org (Postfix) with ESMTP id C84E213C467 for ; Wed, 28 Feb 2007 16:13:08 +0000 (UTC) (envelope-from david.robillard@gmail.com) Received: by nz-out-0506.google.com with SMTP id r28so195012nza for ; Wed, 28 Feb 2007 08:13:08 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=J0+qMJEex7NLXAZifeN/HkqHrsGZ8GzPkNEFRTU1ipBdMdx/jedlwiL1Io++0/W6VyM4UB7VK1xRDKs11PhRGyy9f159lAwYHf4joppOC2wBQkbZEDCMn6pi2tm8V8bVj1JMuM58Ak8OeDFR/td4U2A2bSnvKRWteQPG4vtLH10= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=UeF7Ejc4b+S5pTfgqe2Vf/4p7B1MAljLsCyRbG7AdZjU62yVgpFW30Eejkf8jMi2XEOVZzg2m7CdXv0HAJNqmu/To4LIxg5m/vNBQ0J9QZIbM1A+qNNdAzSG9sxGx6bBBhvWJYaLHwgVUM9dm/vpjutrXO4u/VRTwysAmggfnyE= Received: by 10.65.121.9 with SMTP id y9mr1229851qbm.1172679188040; Wed, 28 Feb 2007 08:13:08 -0800 (PST) Received: by 10.64.210.7 with HTTP; Wed, 28 Feb 2007 08:13:07 -0800 (PST) Message-ID: <226ae0c60702280813q288f646bt8fb8fca886716ee4@mail.gmail.com> Date: Wed, 28 Feb 2007 11:13:08 -0500 From: "David Robillard" To: "FreeBSD Questions" In-Reply-To: <45E53C8F.8090100@placidpublishing.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <226ae0c60702151024u6c71d50bn72d54631c33ed32@mail.gmail.com> <45D4D40F.2060703@placidpublishing.net> <226ae0c60702151407t56632fafoa3eabe714b567d1b@mail.gmail.com> <45D4DF88.1020009@placidpublishing.net> <226ae0c60702151454x4b32e698hb89b51005b6938e@mail.gmail.com> <45D5FD5B.6030605@placidpublishing.net> <226ae0c60702161146i6ce6b54ayab9e279c9cf28d1@mail.gmail.com> <45E53C8F.8090100@placidpublishing.net> Cc: peter@placidpublishing.net Subject: Re: Apache Rotate Logs and Log Rotate. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Feb 2007 16:13:09 -0000 On 2/28/07, Peter Pluta wrote: > Hey David, quick question. I found this while doing a bit of reading. Is > it safe for Syslogd to send a kill -HUP to apache? This site is > extremely high traffic and I wouldn't want it cutting off users during > the HUP to rotate the logs. I'm running Apache 2.2.4 and FreeBSD 6.2 > > http://www.freebsddiary.org/startstop.php > > It looks like Apachectl graceful is the only safe way to restart apache. Hi Peter, The article you're refering to is for Apache 1.3.x and you seem to be running 2.2.x Should you want, you can get more detailed information on how Apache 1.3.x handles kill signals here: http://httpd.apache.org/docs/1.3/stopping.html It's basically the same for Apache 2.2.x which is covered here: http://httpd.apache.org/docs/2.2/stopping.html Having said that, if your site is really busy, then consider changing the kill signal in newsyslog.conf from -HUP to -USR1 which will gracefully ask running httpd processes to restart once they have finished talking to their user. As the article says: ''The USR1 signal causes the parent process to advise the children to exit after their current request (or to exit immediately if they're not serving anything). The parent re-reads its configuration files and re-opens its log files. As each child dies off the parent replaces it with a child from the new generation of the configuration, which begins serving new requests immediately.'' Check the man page for newsyslog.conf(5) at http://www.freebsd.org/cgi/man.cgi?query=newsyslog.conf&apropos=0&sektion=0&manpath=FreeBSD+6.2-RELEASE&format=html The last field in newsyslog.conf is where you setup which signal is used. Here's what the man page says: signal_number This optional field specifies the signal number that will be sent to the daemon process (or to all processes in a process group, if the U flag was specified). If this field is not present, then a SIGHUP signal will be sent. Cheers, David > David Robillard wrote: > > Hi Peter, > > > >> Someone told me that I need to gracefully restart apache for it to make > >> a new log; and then wait till Apache's memory buffer is emptied to disk > >> before gziping or bziping the files. > > > > Well, I've never had to do this. Newsyslog send a `kill -HUP` to > > apache's master PID. Which causes Apache to reopen it's log files. For > > me anyway, the newsyslog configuration I gave you never caused me any > > problem at all. Keep in mind that you do have to send Apache a -HUP > > signal, otherwise you'll lose logs when newsyslog rotates them. > > > >> Also, is it wise to have logs for each user in their home directory? > >> Someone told me this is a serious security issue; but I can't see why > >> it would be. > > > > It is a security issue if the user has the rights to login to you > > machine. If he dosen't, then you shouldn't be worried. > > > > But I just don't take that chance and make all of my Apache log files > > under /usr/local/www/virtalhost1/logs which is not accessible from > > Apache itself because I setup my DocumentRoot under > > /usr/local/www/virtalhost1/public_html. This way, I know for sure that > > everything for virtualhost1 is under a single directory, but that my > > logs can't be seen by anyone via Apache. > > > > David -- David Robillard UNIX systems administrator & Oracle DBA CISSP, RHCE & Sun Certified Security Administrator Montreal: +1 514 966 0122