Xampp log files growing too big

Q I'm running a box with SUSE 8.2 (yes, I know - it's very old) and Xampp [the Apache distro]. How I can get Xampp's log files into the log rotation possibilities of SUSE? They are growing and growing.

A I take it from your question that you already have Logrotate running and successfully rotating other log files, which are normally configured in /etc/logrotate.d. You need to add a file to this directory for each set of log files you want to rotate. Yes, SUSE 8.2 is rather old; and you do not say which version of Xampp you are using, but this configuration file will rotate the logs for Apache 2 if they are stored in /var/log/apache2:

/var/log/apache2/*log {
missingok
notifempty
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null 2>&1 || true
endscript

Save this as /etc/logrotate.d/apache2, and the logs should be rotated the next time your machine runs Logrotate (usually on a daily Cron job). The options are documented fully in the Logrotate man page. The first line specifies the files to be rotated; the next two lines cause logrotate to move on if the log file is missing or empty; sharedscripts means that the prerotate (not used here) and postrotate functions are run once for all files matching the pattern, instead of once for each file. The postrotate section specifies the action to be taken after rotation. In this case, it reloads Apache's configuration, which causes Apache to release its locks on the old files and start logging to new files. You may need to change the path to the log files, and you might also have to replace /etc/init.d/apache2 reload with apache2ctl restart or apachectl restart. You can also add options to this file to set how often the logs are rotated and how many rotations are given. Otherwise the defaults will be used (four rotations given once a week). For example, the lines

daily
rotate 7

will rotate the logs daily and keep the last seven logs.

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar