View Single Post
  #2  
Old 29th August 2009, 15:29
Bookworm Bookworm is offline
Junior Member
 
Join Date: Aug 2009
Posts: 28
Thanks: 1
Thanked 1 Time in 1 Post
Default

It looks like what could be done, at least as a quick and dirty fix, is modify the /usr/local/ispconfig/server/cron_daily.php file as follows.

Take the logrotation section and duplicate the access log entries with error log entries.

################################################## ################################################## ###
// Manage and compress web logfiles
################################################## ################################################## ###

$sql = "SELECT domain_id, domain, document_root FROM web_domain WHERE server_id = ".$conf["server_id"];
$records = $app->db->queryAllRecords($sql);
foreach($records as $rec) {
$yesterday = date("Ymd",time() - 86400);
$logfile = escapeshellcmd($rec["document_root"].'/log/'.$yesterday.'-access.log');
$errorfile = escapeshellcmd($rec["document_root"].'/log/'.$yesterday.'-error.log');
if(@is_file($logfile)) {
// Compress yesterdays logfile
exec("gzip -c $logfile > $logfile.gz");
unlink($logfile);
}
if(@is_file($errorfile)) {
// Compress yesterdays logfile
exec("gzip -c $errorfile > $errorfile.gz");
unlink($errorfile);
}

// delete logfiles after 7 days
$week_ago = date("Ymd",time() - 86400 * 7);
$logfile = escapeshellcmd($rec["document_root"].'/log/'.$week_ago.'-access.log.gz');
$errorfile = escapeshellcmd($rec["document_root"].'/log/'.$week_ago.'-error.log.gz');
if(@is_file($logfile)) {
unlink($logfile);
}
if(@is_file($errorfile)) {
unlink($errorfile);
}
}

#####

I haven't tried it yet - I just put it in myself - but it should work fine.
Reply With Quote