Rotating Apache HTTPD access.log and error.log on Windows

Submitted by Jochus on Thu, 24/09/2015 - 21:07 | Posted in: Windows


By default, access requests, errors, and some other segmented data, is written into separate log files, which are not rotated by Apache.

These log files grow in size as new log data is appended with each additional access request made. And it’s left to the user to (once in a while) stop Apache, and rotate (i.e., rename) or delete the log files, so everything starts from size-zero again.

To automatically rotate a website's access.log (and other log files such as the error.log) every 24 hours (daily), Apache's included rotatelogs.exe tool can be used.

Example configuration:

ErrorLog "|bin/rotatelogs.exe -l #PATH_TO_ERROR_FILE%/errorlog.%Y-%m-%d.txt 86400"
CustomLog "|bin/rotatelogs.exe -l #PATH_TO_ACCESS_FILE%/accesslog.%Y-%m-%d.txt 86400" combinedtrueout_host

Add new comment

The content of this field is kept private and will not be shown publicly.

Full HTML

  • Lines and paragraphs break automatically.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.
  • Web page addresses and email addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <cpp>, <css>, <html5>, <java>, <php>, <sql>, <xml>. The supported tag styles are: <foo>, [foo].
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.