Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 44944 invoked from network); 23 Sep 2007 11:14:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Sep 2007 11:14:24 -0000 Received: (qmail 25592 invoked by uid 500); 23 Sep 2007 11:14:04 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 25576 invoked by uid 500); 23 Sep 2007 11:14:04 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 25563 invoked by uid 99); 23 Sep 2007 11:14:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Sep 2007 04:14:04 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of info@apachelounge.com designates 213.46.255.22 as permitted sender) Received: from [213.46.255.22] (HELO viefep34-int.chello.at) (213.46.255.22) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Sep 2007 11:14:02 +0000 Received: from land10web.com ([62.194.40.33]) by viefep34-int.chello.at (InterMail vM.7.08.02.00 201-2186-121-20061213) with ESMTP id <20070923111339.BBOI24764.viefep34-int.chello.at@land10web.com> for ; Sun, 23 Sep 2007 13:13:39 +0200 Received: from mother (unverified [62.194.40.33]) by land10web.com (Land10 mail) with ESMTP id 480-1959671 for ; Sun, 23 Sep 2007 13:13:39 +0200 Message-ID: <001001c7fdd2$cacfe450$0100a8c0@mother> From: "Steffen" To: References: <00c201c7fa63$4745c6d0$d5d15470$@biz> <46F23A2D.4040603@gmail.com> Date: Sun, 23 Sep 2007 13:13:29 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Virus-Checked: Checked by ClamAV on apache.org Subject: [users@httpd] Apache 2.2, rotatelogs and Windows There are other ways to do it. ---- You can use the Sambar Server (free version, http://www.sambarserver.info) to automatically rotate the logs without stopping/starting Apache. I am running Sambar just for the very handy utilities in it and do not serve sites with it. Sambar has a sophisticated log rotation feature. It empties the logs and saves (daily, weekly, montly) the rotated logs compressed in folders like ..\log\2007\09\acces.log-23.gz and it can generate simple Log Reports (can even be mailed to you). Also there is a web-interface to view logs, this with a search facility. Configuration in short: run Sambar on an other port and define in Sambar the same logs (and log format) as in Apache, Sambar and Apache shares the same logs (you can instruct Sambar not to log request). When you have logs for your virtual hosts you can also share them as well as the error.log (define in Apache the Sambar log location server.log). ---- Also you can use Awstats a logfile analyzer http://awstats.sourceforge.net/ It has a option after you run the statistics to clean the log and backup the log file. ---- And final with no starting/stopping: Just copy (not a move like in the script below) the logs from an running Apache to an other location and (g)zip it and copy emtpy logfiles over to the Apache logs. Steffen ----- Original Message ----- From: "Mark A. Craig" To: Sent: Thursday, 20 September, 2007 11:15 Subject: Re: [users@httpd] Apache 2.2, rotatelogs.exe, and Windows > In the meantime, I managed to find this, which I thought worth sharing in > spite of the bad English grammar: > > AB's Useful Box - Apache for Win32 Log file Rotation > > So you have finished installing Apache for Win32, one of the best web > servers you can get on your WinNT / Win2K / WinXP machine, but find that > it's log files, access.log and error.log just keep on growing ! > > Well fear not, it is possible to manage those log files, and automate the > process with out to much grief. > > The following batch file, the was written and tested on WinXP, but should > just as well on WinNT and Win2K, should: > > * store the current date and time into a varible > * stop the Apache web service > * move the log files, using the date/time as unique filename > * restart the Apache web service > * if prefered, use a command line zip utility to zip the logs > * keep only the last "x" logs, and delete old > > @echo off > :: Name - svrlogmng.bat > :: Description - Server Log File Manager > :: > :: History > :: Date Authory Change > :: 22-May-2005 AGButler Original > :: > > :: ======================================================== > :: setup variables and parameters > :: ======================================================== > > :: generate date and time varibles > for /f "tokens=2,3,4 delims=/ " %%i in ('date /T') do set trdt=%%k%%j%%i > for /f "tokens=1,2 delims=: " %%i in ('time /T') do set trtt=%%i%%j > set nftu=%trdt%%trtt% > > :: set the Number Of Archives To Keep > set /a noatk=7 > > > :: ======================================================== > :: turn over log files > :: ======================================================== > > :: change to the apacge log file direcoty > cd "c:\program files\apache group\apache\logs\" > > > :: stop Apache Service, Move log files and restart Apache Service > net stop apache > > echo %nftu% >> access.log > move "c:\program files\apache group\apache\logs\access.log" "c:\program > files\apache group\apache\logs\%nftu%_access.log" > > echo %nftu% >> error.log > move "c:\program files\apache group\apache\logs\error.log" "c:\program > files\apache group\apache\logs\%nftu%_error.log" > > net start apache > > > :: ======================================================== > :: zip todays Access and Error log files, then delete old logs > :: ======================================================== > > :: zip the files > 7za a -tzip %nftu%_logs.zip %nftu%_access.log %nftu%_error.log > > :: del the files > del /Q %nftu%_*.log > > > :: ======================================================== > :: rotate the zip files > :: ======================================================== > > :: make list of archive zip files > type NUL > arclist.dat > for /F "tokens=1,2 delims=[] " %%i in ('dir /B *_logs.zip ^| find /N > "_logs.zip"') do echo %%i = %%j>> arclist.dat > > :: count total number of files > for /F "tokens=1 delims=" %%i in ('type arclist.dat ^| find /C > "_logs.zip"') do > set tnof=%%i > > :: setup for and create the deletion list > set /a negtk=%noatk%*-1 > set /a tntd=%tnof% - %noatk% > > type NUL>dellist.dat > for /L %%i in (%negtk%,1,%tntd%) do find " %%i = " arclist.dat >> > dellist.dat > > :: del the old files > for /F "tokens=3 delims= " %%i in ('find "_logs.zip" dellist.dat') do del > /Q %%i > > :: remove temp files > del /Q arclist.dat > del /Q dellist.dat > > > :end > > The command line 7za zip utility is available from http://www.7-zip.org > > The best method is to just put the 7za.exe file into your system32 folder. > > Then it is just a matter of calling the batch file from the windows > scheduler. On WinNT this is done on the commend line via AT and on WinXP > this is done via Scheduled Tasks found in the Control Panel. > > Some other things that can be done after the files have been moved, but > before they are zipped, it to produce statistics from the access.log data. > For example, how many times pages are being visited and from where. > > > -------- Original Message -------- > Subject: Re: [users@httpd] Apache 2.2, rotatelogs.exe, and Windows > From: Phillip Hamilton > To: users@httpd.apache.org > Date: Tuesday, September 18, 2007 07:17:50 PM > >> I'll be back at my post on Monday, from there I'll be able to access the >> files and I'd be happy to share it. >> >> It's very simple if you're familiar with batch files. >> >> 1. Stop apache (using net stop) >> 2. Move logs to new folder (xcopy) >> 3. Restart apache (net start) >> 4. Rar the logs up with Winrar (smaller files than Winzip, RAR.EXE -m >> file). >> >> Lather, rinse, repeat every 12 hours. The server is only down a split >> second >> so no one even notices. The file move (since it's not a copy) is almost >> instant. >> >> If you come up with something snazzy with WSH I'd be interested in taking >> a >> peek >> if you feel like sharing. -----Original Message----- >> From: Mark A. Craig [mailto:mark.a.craig@gmail.com] Sent: Tuesday, >> September 18, 2007 2:01 PM >> To: users@httpd.apache.org >> Subject: Re: [users@httpd] Apache 2.2, rotatelogs.exe, and Windows >> >> Philip, do you use a scheduled CMD file to gracefully kill the server, >> rotate the logs, and then restart the server? Given that rumor has it >> that piping >> is broken in 2.2.4, it seems something like that is the only way to do it >> right >> >> now, eh? If what you're using contains no trade secrets, I'd be very >> curious to see exactly what you're using, so I can use it as boilerplate >> for my own solution. I wonder if it could also be accomplished via a WSH >> file instead, >> and whether that would provide extra flexibility or benefits? >> >> Mark >> >> -------- Original Message -------- >> Subject: Re: [users@httpd] Apache 2.2, rotatelogs.exe, and Windows >> From: Phillip Hamilton >> To: users@httpd.apache.org >> Date: Tuesday, September 18, 2007 11:50:08 AM >> >>> I wholeheartedly disagree with this statement: >>> Apache holds only a tiny share of Windows servers. >>> >>> Apache holds a very large share of Windows server market, hence the >>> pre-made binary. >>> Back on topic, I rotate via a bat file with a quick re-start on my >>> windows >>> boxes ;) >>> >>> -----Original Message----- >>> From: Dragon [mailto:dragon@crimson-dragon.com] Sent: Tuesday, September >>> 18, 2007 1:02 PM >>> To: users@httpd.apache.org >>> Subject: Re: [users@httpd] Apache 2.2, rotatelogs.exe, and Windows >>> >>> Mark A. Craig wrote: >>>> So this leads me to ask again, what are all of you successful 2.2.4 >>>> admins using to rotate your logs? If the piping mechanism is broken, >>>> at least in the Windows binary, then what other technique(s) are people >>>> using? Task Scheduler with a batch or CMD file? >>>> >>>> So far I've been manually rotating the logs, but I'd understandably >>>> like to automate it. >>> ---------------- End original message. --------------------- >>> >>> I think you will find that the vast majority of people using Apache are >>> not doing so on the Windows platform. Most people who have committed to >>> the Windows platform have also committed to IIS. Apache dominates the >>> Linux environment and is used frequently on BSD and similar Unix-based >>> platforms. Apache holds only a tiny share of Windows servers. >>> >>> I believe that those few who are using Apache on Windows tend to be >>> hobbyists or developers using it to serve their own stuff or to do >>> development off-line. I am willing to bet there are very few people >>> using it in a production environment under Windows. >>> >>> So it is entirely possible that there may be nobody on this list who has >>> an answer for you. The set of people using it in the same manner you are >>> is small to begin with and there may not be many of them subscribed to >>> this list. >>> >>> Repeatedly posting demanding >>> >>> Dragon > > --------------------------------------------------------------------- > The official User-To-User support forum of the Apache HTTP Server Project. > See for more info. > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org > " from the digest: users-digest-unsubscribe@httpd.apache.org > For additional commands, e-mail: users-help@httpd.apache.org > > --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See for more info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org " from the digest: users-digest-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org