#1  
Old 14th July 2009, 08:31
Alex1 Alex1 is offline
Junior Member
 
Join Date: May 2007
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error.log rotation

Hello

can you add the rotation of vhosts' error.log in the next version? sometimes it can be very big causing problems in user's quota.
Reply With Quote
Sponsored Links
  #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
  #3  
Old 27th March 2010, 12:14
Keeper Keeper is offline
Member
 
Join Date: Aug 2009
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I just updated to the latest ISPConfig3 and was wondering why it still does not have error log rotation?

Above script posted by Bookworm doesn't work by the way.
Reply With Quote
  #4  
Old 28th March 2010, 22:37
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,421
Thanks: 812
Thanked 5,205 Times in 4,081 Posts
Default

Please look at the roadmap.

http://bugtracker.ispconfig.org

Quote:
I just updated to the latest ISPConfig3 and was wondering why it still does not have error log rotation?
Because nobody has written such a function yet. So feel free to write it and contribute the code to the ispconfig project if you miss a feature.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 29th March 2010, 07:31
Keeper Keeper is offline
Member
 
Join Date: Aug 2009
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If I could write it, I already would have.

I serve over 45 websites with ISPConfig, many of those currently have error.log over 200MB in size because there's no rotation. Going through each domain by hand is not really practical, though I've done it a few times.

My guess is that average error.log size could be around 100MB, which would mean nearly 5GB is taken by just error.logs.
Reply With Quote
  #6  
Old 30th March 2010, 12:17
abubin abubin is offline
Member
 
Join Date: Mar 2010
Posts: 81
Thanks: 0
Thanked 2 Times in 2 Posts
Default

this shouldn't be that hard to do. Just modify the codes from access logrotate script in cron_daily.php
Reply With Quote
Reply

Bookmarks

Tags
log rotate error

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Server crashed by unlimited error.log size - how to set a limit? tom Installation/Configuration 16 22nd April 2008 12:16
Log Rotation Errors. Please Help!! paul sanz Technical 1 14th April 2008 13:02
Not writing to error.log Hotwire General 6 7th June 2007 21:16
log fie rotation hans2512 Installation/Configuration 1 3rd April 2007 11:29
favicon.ico eating my error.log danf.1979 General 4 10th March 2006 01:37


All times are GMT +2. The time now is 02:35.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.