@ECHO OFF
set Day=%Date:~7,2%
set Mth=%Date:~4,2%
set Yr=%Date:~10,4%
ECHO Creating directory....
MKDIR ..\logs\%Yr%%Mth%%Day%
C:\progra~1\apache~1\apache2.2\bin\httpd.exe -k stop
ECHO Copying logs to archive directory
MOVE /Y ..\logs\*.* ..\logs\%Yr%%Mth%%Day%
C:\progra~1\apache~1\apache2.2\bin\httpd.exe -k start
Thursday, January 07, 2010
Rotate Apache Logs on Windows Server
I have a Windows Apache server that has the logs that grow all the time. I've been just archiving these logs on a inconsistent basis, but decided a more formalized and automated process needs to handle it. Since the rotatelogs.exe from Apache seems to have issues on Windows servers, I wrote the following batch file and scheduled it to run every day at 12:00 AM on my Apache server:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment