mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
Gather statistics for spam and virus messages
This commit is contained in:
@@ -109,8 +109,10 @@ class AverageTraffic(Graphic):
|
||||
recv = Curve("recv", "steelblue", ugettext_lazy("received messages"))
|
||||
bounced = Curve("bounced", "yellow", ugettext_lazy("bounced messages"))
|
||||
reject = Curve("reject", "tomato", ugettext_lazy("rejected messages"))
|
||||
virus = Curve("virus", "orange", ugettext_lazy("virus messages"))
|
||||
spam = Curve("spam", "silver", ugettext_lazy("spam messages"))
|
||||
|
||||
order = ['reject', 'bounced', 'recv', 'sent']
|
||||
order = ['reject', 'bounced', 'recv', 'sent', 'virus', 'spam']
|
||||
|
||||
|
||||
class AverageTrafficSize(Graphic):
|
||||
|
||||
@@ -297,6 +297,14 @@ class LogParser(object):
|
||||
if not m:
|
||||
return
|
||||
host, prog, pid, log = m.groups()
|
||||
m = re.search("(INFECTED|SPAMMY) .* <[^>]+> -> <[^@]+@([^>]+)>.*", log)
|
||||
if m is not None:
|
||||
if m.group(2) in self.domains:
|
||||
if m.group(1) == 'INFECTED':
|
||||
self.inc_counter(m.group(2), 'virus')
|
||||
elif m.group(1) == 'SPAMMY':
|
||||
self.inc_counter(m.group(2), 'spam')
|
||||
return
|
||||
m = self._id_expr.match(log)
|
||||
if m is None:
|
||||
self._dprint("Unknown line format: %s" % log)
|
||||
|
||||
Reference in New Issue
Block a user