Using the Uniform Server to run Apache on Windows. Here is a simple way to implement log rotation using a batch file with Robocopy.
The script creates a date-named folder, then stops Apache, moves all the log files to the new folder, then restarts Apache.
I wanted to keep it simple, so there is no compression or purging of old logs, just a simple system to keep the log files from getting large. It is run once a week from a scheduled task.
set folder=%date:~10,4%_%date:~4,2%_%date:~7,2%
mkdir D:\data\rotatelogs\%folder%
net stop us_apache_1
robocopy D:\data\UniServerZ\core\apache2\logs\ D:\data\rotatelogs\%folder%\ *.log /MOV
net start us_apache_1

Leave a Reply