Fixed:
- log parsing did not recognize lines with multiple recipients
- spamfilter_users added to datalog status messages
| | |
| | | |
| | | $result = $this->queryAllRecords("SELECT COUNT( * ) AS cnt, sys_datalog.action, sys_datalog.dbtable FROM sys_datalog, server WHERE server.server_id = sys_datalog.server_id AND sys_datalog.user = '" . $this->quote($login) . "' AND sys_datalog.datalog_id > server.updated GROUP BY sys_datalog.dbtable, sys_datalog.action"); |
| | | foreach($result as $row) { |
| | | if(!$row['dbtable'] || in_array($row['dbtable'], array('spamfilter_users', 'aps_instances', 'aps_instances_settings', 'mail_access', 'mail_content_filter'))) continue; // ignore some entries, maybe more to come |
| | | if(!$row['dbtable'] || in_array($row['dbtable'], array('aps_instances', 'aps_instances_settings', 'mail_access', 'mail_content_filter'))) continue; // ignore some entries, maybe more to come |
| | | $return['entries'][] = array('table' => $row['dbtable'], 'action' => $row['action'], 'count' => $row['cnt'], 'text' => $app->lng('datalog_status_' . $row['action'] . '_' . $row['dbtable'])); |
| | | $return['count'] += $row['cnt']; |
| | | } |
| | |
| | | $wb['datalog_status_i_mail_user'] = 'Neues E-Mail Konto anlegen'; |
| | | $wb['datalog_status_u_mail_user'] = 'E-Mail Konto ändern'; |
| | | $wb['datalog_status_d_mail_user'] = 'E-Mail Konto löschen'; |
| | | $wb['datalog_status_i_spamfilter_users'] = 'Spamfilter-Einstellungen anlegen'; |
| | | $wb['datalog_status_u_spamfilter_users'] = 'Spamfilter-Einstellungen ändern'; |
| | | $wb['datalog_status_d_spamfilter_users'] = 'Spamfilter-Einstellungen löschen'; |
| | | $wb['datalog_status_i_mail_forwarding'] = 'Neue E-Mail Adresse anlegen'; |
| | | $wb['datalog_status_u_mail_forwarding'] = 'E-Mail Adresse ändern'; |
| | | $wb['datalog_status_d_mail_forwarding'] = 'E-Mail Adresse löschen'; |
| | |
| | | $wb['datalog_status_i_mail_user'] = 'Create email user'; |
| | | $wb['datalog_status_u_mail_user'] = 'Update email user'; |
| | | $wb['datalog_status_d_mail_user'] = 'Delete email user'; |
| | | $wb['datalog_status_i_spamfilter_users'] = 'Create spam filter settings'; |
| | | $wb['datalog_status_u_spamfilter_users'] = 'Update spam filter settings'; |
| | | $wb['datalog_status_d_spamfilter_users'] = 'Delete spam filter settings'; |
| | | $wb['datalog_status_i_mail_forwarding'] = 'Create email address'; |
| | | $wb['datalog_status_u_mail_forwarding'] = 'Update email address'; |
| | | $wb['datalog_status_d_mail_forwarding'] = 'Delete email address'; |
| | |
| | | |
| | | function parse_mail_log_line($line) { |
| | | //Oct 31 17:35:48 mx01 amavis[32014]: (32014-05) Passed CLEAN, [IPv6:xxxxx] [IPv6:xxxxx] <xxx@yyyy> -> <aaaa@bbbb>, Message-ID: <xxxx@yyyyy>, mail_id: xxxxxx, Hits: -1.89, size: 1591, queued_as: xxxxxxx, 946 ms |
| | | if(preg_match('/^(\w+ \d+ \d+:\d+:\d+) [^ ]+ amavis.* <([^>]+)> -> <([^>]+)>, Message-ID: <([^>]+)>.* size: (\d+),.*$/', $line, $matches) == false) return false; |
| | | |
| | | if(preg_match('/^(\w+\s+\d+\s+\d+:\d+:\d+)\s+[^ ]+\s+amavis.* <([^>]+)>\s+->\s+((<[^>]+>,)+) .*Message-ID:\s+<([^>]+)>.* size:\s+(\d+),.*$/', $line, $matches) == false) return false; |
| | | |
| | | $timestamp = strtotime($matches[1]); |
| | | if(!$timestamp) return false; |
| | | |
| | | return array('line' => $line, 'timestamp' => $timestamp, 'size' => $matches[5], 'from' => $matches[2], 'to' => $matches[3], 'message-id' => $matches[4]); |
| | | $to = array(); |
| | | $recipients = explode(',', $matches[3]); |
| | | foreach($recipients as $recipient) { |
| | | $recipient = substr($recipient, 1, -1); |
| | | if(!$recipient || $recipient == $matches[2]) continue; |
| | | $to[] = $recipient; |
| | | } |
| | | |
| | | return array('line' => $line, 'timestamp' => $timestamp, 'size' => $matches[6], 'from' => $matches[2], 'to' => $to, 'message-id' => $matches[5]); |
| | | } |
| | | |
| | | function add_mailbox_traffic(&$traffic_array, $address, $traffic) { |
| | |
| | | } |
| | | |
| | | add_mailbox_traffic($mailbox_traffic, $cur_line['from'], $cur_line['size']); |
| | | add_mailbox_traffic($mailbox_traffic, $cur_line['to'], $cur_line['size']); |
| | | foreach($cur_line['to'] as $to) { |
| | | add_mailbox_traffic($mailbox_traffic, $to, $cur_line['size']); |
| | | } |
| | | $last_line = $line; // store for the state file |
| | | } |
| | | fclose($fp); |
| | |
| | | } |
| | | |
| | | add_mailbox_traffic($mailbox_traffic, $cur_line['from'], $cur_line['size']); |
| | | add_mailbox_traffic($mailbox_traffic, $cur_line['to'], $cur_line['size']); |
| | | foreach($cur_line['to'] as $to) { |
| | | add_mailbox_traffic($mailbox_traffic, $to, $cur_line['size']); |
| | | } |
| | | } |
| | | fclose($fp); |
| | | //echo "\n"; |