Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 17th February 2011, 20:23
mike_p mike_p is offline
Senior Member
Join Date: Mar 2010
Location: Surrey, England
Posts: 140
Thanks: 9
Thanked 28 Times in 17 Posts
Default More on presentation of logs ...

1/ Formatting logs.

I think we can improve on the 'raw' display of logs, so I've been experimenting with better formatting.

I've written a simple function to go in the show_log.php script that converts the data into an html table:

function log_to_table($datastring) {
  $data_lines = explode("\n", $datastring);
  $html = "<table class='log_table'>";
  foreach ($data_lines as $value) {
    $items = explode(' ',$value,6);
    $html .= "<tr>";
    $html .= "<td>$items[0] $items[1]</td>"; //date
    $html .= "<td>$items[2]</td>"; //time
    $html .= "<td>$items[3]</td>"; //server
    $html .= "<td>$items[4]</td>"; //user
    $html .= "<td>$items[5]</td>"; //data
    $html .= "<tr>";
  $html .= "</table>";
  return $html;
then I replace the nl2br function with log_to_table.

After that we need a little tidying up with the css. In my test I use:

table.log_table td {
     font-family: Trebuchet MS;
     border-width: 1px;
     padding: 1px 3px;
     border-style: solid;
     border-color: #ded;
Conceptually I'm not sure where it should be placed. In my case I've added it to the end of content.css.

2/ In Redhat[Centos] and Gentoo distributions the maillog, mail error and mail warning logs all show the content of maillog.

I propose we split the logs.

1. Edit /etc/syslog.conf replace
# Log all the mail messages in one place.
mail.*                                                  -/var/log/maillog
mail.info;mail.!warn    /var/log/maillog
mail.warn;mail.!err     /var/log/mail.warn
mail.err        /var/log/mail.err
then restart syslog with /etc/init.d/syslog restart

2/ Adjust ISPConfig to use the new error and warning logs:
Edit monitor_core_module.inc.php around line 1666 change

case 'log_mail_warn':
	if($dist == 'debian') { $logfile = '/var/log/mail.warn'; }
	elseif($dist == 'redhat') { $logfile = '/var/log/maillog'; }
	elseif($dist == 'suse') { $logfile = '/var/log/mail.warn'; }
	elseif($dist == 'gentoo') { $logfile = '/var/log/maillog'; }
case 'log_mail_err':
        if($dist == 'debian') { $logfile = '/var/log/mail.err'; }
        elseif($dist == 'redhat') { $logfile = '/var/log/maillog'; }
        elseif($dist == 'suse') { $logfile = '/var/log/mail.err'; }
	elseif($dist == 'gentoo') { $logfile = '/var/log/maillog'; }
case 'log_mail_warn':
	$logfile = '/var/log/mail.warn'; 
case 'log_mail_err':
        $logfile = '/var/log/mail.err'; 
I've tested in Centos, can't be sure of Gentoo.

Might also need to have a play with "logrotate".

Anyone interested in this being incorporated into the next release?

Last edited by mike_p; 17th February 2011 at 20:35.
Reply With Quote
Sponsored Links


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
ISPconfig is not processing apache logs: the web Traffic overview and stats are gone KingBeto General 12 15th January 2010 19:00
fail2ban Logs AdrianSmithUK Installation/Configuration 9 7th April 2009 15:07
help posting logs to forum and saslauth problem almeister9 HOWTO-Related Questions 3 19th September 2008 17:55
Apache Logs to MySQL Mosquito Technical 2 28th November 2007 17:14
Apache won't start: "Too many files error"? bpmee Server Operation 4 31st July 2007 14:37

All times are GMT +2. The time now is 13:31.

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