• Skip to main content
  • Skip to primary sidebar

AllScoop

Gadgets - PHP Code - ASP Code - Web Tools - Technology

Windows Apache Rotate Logs

Leave a Comment

uniform serverUsing 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

 

Filed Under: tools

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Categories

  • allscoop
  • antenna
  • appliance repair
  • asp scripts
  • bots
  • cars
  • code
  • ecommerce
  • hardware
  • misc
  • mobile
  • news
  • other stuff
  • php code
  • projects
  • seen on tv
  • shopping cart
  • software
  • technology
  • the web
  • tools
  • wordpress

Blogroll

  • Cartridge Library

Resources

  • Cool Stuff
  • Ohio Business
  • Timeclock Software
  • Wiper Blades

Pages

  • 1&1 Business Package Review
  • About AllScoop

Copyright © 2022