fixed parsing due to changes in dovecots default mail_log_prefix
regex supports old and new default format now (see https://wiki2.dovecot.org/Upgrading/2.3)
This commit is contained in:
@@ -209,12 +209,12 @@ class MailLogParser
|
|||||||
|
|
||||||
$timestamp = $this->getLogTimestamp($line);
|
$timestamp = $this->getLogTimestamp($line);
|
||||||
if ($this->startTime < $timestamp) {
|
if ($this->startTime < $timestamp) {
|
||||||
if (preg_match("/dovecot.*(?::|\]) imap\(.*@([a-z0-9\.\-]+)\):.*(?:in=(\d+) out=(\d+)|bytes=(\d+)\/(\d+))/i", $line, $matches)) {
|
if (preg_match("/dovecot.*(?::|\]) imap\(.*@([a-z0-9\.\-]+)\)(<\d+><[a-z0-9+\/=]+>)?:.*(?:in=(\d+) out=(\d+)|bytes=(\d+)\/(\d+))/i", $line, $matches)) {
|
||||||
// Dovecot IMAP
|
// Dovecot IMAP
|
||||||
$this->addDomainTraffic($matches[1], (int) $matches[2] + (int) $matches[3], $timestamp);
|
$this->addDomainTraffic($matches[1], (int) $matches[3] + (int) $matches[4], $timestamp);
|
||||||
} elseif (preg_match("/dovecot.*(?::|\]) pop3\(.*@([a-z0-9\.\-]+)\):.*in=(\d+).*out=(\d+)/i", $line, $matches)) {
|
} elseif (preg_match("/dovecot.*(?::|\]) pop3\(.*@([a-z0-9\.\-]+)\)(<\d+><[a-z0-9+\/=]+>)?:.*in=(\d+).*out=(\d+)/i", $line, $matches)) {
|
||||||
// Dovecot POP3
|
// Dovecot POP3
|
||||||
$this->addDomainTraffic($matches[1], (int) $matches[2] + (int) $matches[3], $timestamp);
|
$this->addDomainTraffic($matches[1], (int) $matches[3] + (int) $matches[4], $timestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user