Software >> Services >> HTTP Server >> Apache >>  How to configure log rotation for Apache from XAMPP for Linux - LAMPP

install directory is /opt/lampp

conf directory is /opt/lampp/etc

for virtual server with configuration file in /opt/lampp/etc/extra/httpd-vhosts.conf

edit this file and look fo the statements defining the ErrorLog and CustomLog for that virtual host

e.g.

 

 
    ErrorLog "logs/www.example.com/error.log"
    CustomLog "logs/www.example.com/access.log" combined
 

 

Change it to

 

 
    ErrorLog "|/opt/lampp/bin/rotatelogs logs/www.example.com/error.log 86400"
    CustomLog "|/opt/lampp/bin/rotatelogs logs/www.example.com/access.log 86400" combined
 

 

86400 is the duration in seconds to rotate the log i.e. in this case 1 day.


activate the settings by restarting lampp

 

 
    /opt/lampp/lampp reload