mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-22 02:17:26 +00:00
mail log scanner: dont assume lines are utf8
This commit is contained in:
parent
399f9d9bdf
commit
3d8ea0e6ed
@ -18,8 +18,9 @@ def scan_mail_log(logger, env):
|
|||||||
|
|
||||||
for fn in ('/var/log/mail.log.1', '/var/log/mail.log'):
|
for fn in ('/var/log/mail.log.1', '/var/log/mail.log'):
|
||||||
if not os.path.exists(fn): continue
|
if not os.path.exists(fn): continue
|
||||||
with open(fn) as log:
|
with open(fn, 'rb') as log:
|
||||||
for line in log:
|
for line in log:
|
||||||
|
line = line.decode("utf8", errors='replace')
|
||||||
scan_mail_log_line(line.strip(), collector)
|
scan_mail_log_line(line.strip(), collector)
|
||||||
|
|
||||||
if collector["imap-logins"]:
|
if collector["imap-logins"]:
|
||||||
|
Loading…
Reference in New Issue
Block a user