View Single Post
  #1  
Old 27th November 2008, 20:13
ivoks ivoks is offline
Junior Member
 
Join Date: Nov 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Bug in mail_logs.php

Hi!

I've noticed a bug in mail_logs.php which generates mail traffic stats. Line in my mail.log:

Nov 15 14:19:04 xxxx postfix/smtpd[27493]: NOQUEUE: reject: RCPT from
xxxxxxxxxxxxxx[xxxxxxxxxxx]: 450 4.1.8
<prvs=1203725193=xxxxxxx@xxxxxxx>: Sender address rejected:
Domain not found; from=<prvs=1203725193=xxxxxxxxx@xxxxxxxxx>
to=<xxxx@xxxx> proto=ESMTP helo=<xxxxxxxxxxx>

resulted in '1203725193' being counted as a mail traffic. This was caused by a line in '/root/ispconfig/scripts/shell/mail_logs.php':

exec("grep -iw ".$mod->system->server_conf["server_mta"]." $dist_mail_log.$datum | grep -iw from | grep -iw $domain | grep -iw $monat_kurz | cut -f2 -d, | cut -f2 -d= > $dist_mail_log.$vhost");

This is wrong. You guys should really use awk or something. I found that:

exec("grep -iw ".$mod->system->server_conf["server_mta"]." $dist_mail_log.$datum | grep -iw from | grep -iw $domain | grep -iw $monat_kurz | grep size= | awk -F', size=' '{print $2}' | cut -d\, -f1 > $dist_mail_log.$vhost");

works much better in my setup (postfix).

Take care.

Last edited by ivoks; 27th November 2008 at 20:18.
Reply With Quote
Sponsored Links