Rotating Log Files on Apache HTTP Server


Consider the following log configuration:-

ErrorLog "D:/logs/apache/error.log"

<IfModule log_config_module>
    CustomLog "D:/logs/apache/access.log" common

At some point of time, both error.log and access.log are going to get insanely large.


To fix this, the logs can be piped (by using |) to Apache HTTP Server’s built-in program called rotatelogs to rotate the log files. For example, the following configuration will create a daily rolling file appender for error.log and access.log.

ErrorLog "|D:/apps/apache/bin/rotatelogs.exe -l D:/logs/apache/error-%Y-%m-%d.log 86400"

<IfModule log_config_module>
    CustomLog "|D:/apps/apache/bin/rotatelogs.exe -l D:/logs/apache/access-%Y-%m-%d.log 86400" common


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s