Commit 3e0034c1 authored by tbrehm's avatar tbrehm

Implemented: FS#1109 - Rotate website error logs and ispconfig log

parent 2a704f6c
......@@ -23,6 +23,7 @@
ServerAdmin webmaster@<tmpl_var name='domain'>
ErrorLog /var/log/ispconfig/httpd/<tmpl_var name='domain'>/error.log
<tmpl_if name='errordocs'>
ErrorDocument 400 /error/400.html
......
......@@ -207,6 +207,13 @@ foreach($records as $rec) {
exec("gzip -c $logfile > $logfile.gz");
unlink($logfile);
}
// rotate and compress the error.log when it exceeds a size of 10 MB
$logfile = escapeshellcmd($rec["document_root"].'/log/error.log');
if(is_file($logfile) && filesize($logfile) > 10000000) {
exec("gzip -c $logfile > $logfile.1.gz");
exec("cat /dev/null > $logfile");
}
// delete logfiles after 30 days
$month_ago = date("Ymd",time() - 86400 * 30);
......@@ -216,6 +223,17 @@ foreach($records as $rec) {
}
}
#######################################################################################################
// Rotate the ispconfig.log file
#######################################################################################################
// rotate the ispconfig.log when it exceeds a size of 10 MB
$logfile = '/var/log/ispconfig/ispconfig.log');
if(is_file($logfile) && filesize($logfile) > 10000000) {
exec("gzip -c $logfile > $logfile.1.gz");
exec("cat /dev/null > $logfile");
}
#######################################################################################################
// Cleanup website tmp directories
#######################################################################################################
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment