Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #11  
Old 4th January 2008, 01:59
lewis_saint lewis_saint is offline
Member
 
Join Date: Mar 2007
Posts: 69
Thanks: 0
Thanked 3 Times in 2 Posts
Default

I too am having problems. All of my rotated mail.log files start at 23:59 and end at 06:25. It is as if ISPC deletes all prior content in the log file when it analyses it at 23:59. Till, falko, any suggestions?
Regards,
Lewis
Reply With Quote
Sponsored Links
  #12  
Old 20th January 2008, 22:28
xrat xrat is offline
Member
 
Join Date: Nov 2006
Location: Vienna, Austria
Posts: 56
Thanks: 68
Thanked 17 Times in 13 Posts
Default

Eventually, I took the time to investigate this a bit more. My Debian box with ISPconfig is running Debian 4.0 "Etch" (pretty much a default installation) with a current ISPconfig v2.2.19.

The problem persists: /var/log/mail.log.0 shows only lines from midnight until approximately 6:30. The reason is, vaguely put, a conflict between default Debian log file rotation and ISPconfig, more specifically its cronjob
Code:
59 23 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/mail_logs.php
BTW, if you miss your data have a look at the other mail.* log files, especially /var/log/mail.info

Whether your Debian log file rotation kicks in or not you can check with
Code:
syslogd-listfiles --weekly
It returns all files which get rotated weekly by means of /etc/cron.weekly/sysklogd which again, on my system, is run every Sunday morning at 6:47 (see /etc/crontab).

But the main problem I see -- sorry to say this -- in ISPconfig's /root/ispconfig/scripts/shell/mail_logs.php -- though the whole issue is definitely not trivial. Anyway, from my point of view, mail_logs.php needs some rethinking.

As till wrote, mail_logs.php is working on a temporary copy. I guess he referred to line 53
Code:
$mod->log->caselog("cp -f $dist_mail_log $dist_mail_log.$datum", $FILE, __LINE__);
So this is true. But a few lines further below the original data is overwritten with
Code:
$fp = fopen($dist_mail_log, "w");
fwrite($fp, "");
fclose($fp);
There our data is lost. mail_logs.php deletes everything until midnight.

I do not know enough about ISPconfig but I am afraid this here is bound to break on systems with log rotation that occurs during the day. I guess it also means that ISPconfig's mail stats are not accurate. Certainly, just disabling the lines which erase $dist_mail_log does not help.

Nevertheless, maybe there is a simpler fix since till reported that he has never seen this problem, probably for a reason.

HTH,
-- xrat

P.S.: In mail_logs.php there are references to $datum2 which I assume does not exist/is empty. It does not break the script but I recommend to fix it anyway should the code ever be used somewhere else.
Reply With Quote
  #13  
Old 22nd January 2008, 07:44
xrat xrat is offline
Member
 
Join Date: Nov 2006
Location: Vienna, Austria
Posts: 56
Thanks: 68
Thanked 17 Times in 13 Posts
Smile A quick fix

Quote:
Originally Posted by xrat
Whether your Debian log file rotation kicks in or not you can check with syslogd-listfiles --weekly. It returns all files which get rotated weekly by means of /etc/cron.weekly/sysklogd which again, on my system, is run every Sunday morning at 6:47 (see /etc/crontab).
When I wrote this I missed the fact that mail.log is also rotated on a daily basis at 6:25 by means of /etc/crontab -> /etc/cron.daily/sysklogd

A quick fix to the issues pointed out above is the following:

Make syslog to log all mail.* data to another log file which is then used only by ISPconfig. E.g. add to /etc/syslog.conf the line
Code:
mail.*    -/var/log/mail.log4ispc
Create a copy of the already existing log file with the new name and reload syslog's configuration with
Code:
cd /var/log
cp -a mail.log mail.log4ispc && /etc/init.d/sysklogd reload
Then change the log file name in ISPconfig. Login as admin and go to Management > Server > Settings. On tab "EMail" change field "Log File" from (I suppose, at least for Debian) /var/log/mail.log to /var/log/mail.log4ispc

Note that with these settings also /var/log/mail.log4ispc will get automagically rotated by Debian's sysklogd but only weekly. Thus, every Sunday the mail stats of ISPconfig will miss 6 hours.

Please check yourself if the here suggested changes are suitable for your system.

HTH,
-- xrat
Reply With Quote
The Following User Says Thank You to xrat For This Useful Post:
till (22nd January 2008)
  #14  
Old 22nd January 2008, 08:51
Morons Morons is offline
Senior Member
 
Join Date: Aug 2006
Posts: 189
Thanks: 8
Thanked 15 Times in 7 Posts
Cool Proper Cron!

Best practice would be to include the cronjobs into the /etc/cron.daily, /etc/cron.weekly etc.
If we can get all the ispc cron scripts under /etc/cron.daily that process all the daily ispc activity then the system will take care of the timing and rotations will be synchronized.
Reply With Quote
  #15  
Old 22nd January 2008, 13:17
lewis_saint lewis_saint is offline
Member
 
Join Date: Mar 2007
Posts: 69
Thanks: 0
Thanked 3 Times in 2 Posts
Default

Is there a simple fix possible for /root/ispconfig/scripts/shell/mail_logs.php?

Lewis
Reply With Quote
  #16  
Old 23rd January 2008, 07:06
wpwood3 wpwood3 is offline
Senior Member
 
Join Date: Oct 2007
Location: Atlanta, GA USA
Posts: 197
Thanks: 21
Thanked 31 Times in 21 Posts
Default

I am having this same problem.
My mail logs do not include a full 24 hour day.

Is there a fix in the works?
__________________
CentOS 5.4 64bit (the Perfect Setup)
ISPConfig 2.2.40
WP3 Photography
Reply With Quote
  #17  
Old 23rd January 2008, 07:24
xrat xrat is offline
Member
 
Join Date: Nov 2006
Location: Vienna, Austria
Posts: 56
Thanks: 68
Thanked 17 Times in 13 Posts
Default

Dude, it's up there!
Reply With Quote
  #18  
Old 23rd January 2008, 07:40
lewis_saint lewis_saint is offline
Member
 
Join Date: Mar 2007
Posts: 69
Thanks: 0
Thanked 3 Times in 2 Posts
Default

Quote:
Originally Posted by xrat
Note that with these settings also /var/log/mail.log4ispc will get automagically rotated by Debian's sysklogd but only weekly. Thus, every Sunday the mail stats of ISPconfig will miss 6 hours.
By your own words xrat, the fix improves the situation, but does not fully rectify the problem.

Regards,

Lewis
Reply With Quote
  #19  
Old 23rd January 2008, 07:50
wpwood3 wpwood3 is offline
Senior Member
 
Join Date: Oct 2007
Location: Atlanta, GA USA
Posts: 197
Thanks: 21
Thanked 31 Times in 21 Posts
Default

Quote:
Originally Posted by xrat
Dude, it's up there!
Dude...that's a hack. Not a fix.

A fix means that the bug in ISPConfig is addressed so the problem does not occur.
__________________
CentOS 5.4 64bit (the Perfect Setup)
ISPConfig 2.2.40
WP3 Photography
Reply With Quote
  #20  
Old 23rd January 2008, 09:25
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,991
Thanks: 825
Thanked 5,375 Times in 4,222 Posts
 
Default

We will have a look at this. Falko already added it to the bugtracker.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
Reply

Bookmarks

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
log fie rotation hans2512 Installation/Configuration 1 3rd April 2007 11:29
log files, rotation and emailing them hairydog2 General 65 11th October 2006 13:18
Accesslog daily rotation... Ben Developers' Forum 2 1st August 2006 10:58
mail.log is cut arnaud Installation/Configuration 1 6th July 2006 11:58
mail.log : admispconfig@localhost what is that? lyndros Installation/Configuration 1 29th June 2006 13:07


All times are GMT +2. The time now is 16:25.


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