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:
Code:
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:
Code:
table.log_table td {
font-family: Trebuchet MS;
font-size:8pt;
border-width: 1px;
padding: 1px 3px;
border-style: solid;
border-color: #ded;
min-width:4em;
}
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
Code:
# Log all the mail messages in one place.
mail.* -/var/log/maillog
with
Code:
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
Code:
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'; }
break;
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'; }
break;
to
Code:
case 'log_mail_warn':
$logfile = '/var/log/mail.warn';
break;
case 'log_mail_err':
$logfile = '/var/log/mail.err';
break;
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?
Recent comments
1 day 9 hours ago
1 day 18 hours ago
1 day 21 hours ago
1 day 22 hours ago
1 day 23 hours ago
2 days 1 hour ago
2 days 2 hours ago
2 days 3 hours ago
2 days 19 hours ago
2 days 20 hours ago