1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-12-22 07:17:05 +00:00

mail log scanner: dont assume lines are utf8

This commit is contained in:
Joshua Tauberer 2015-01-02 22:49:25 +00:00
parent 399f9d9bdf
commit 3d8ea0e6ed

View File

@ -18,8 +18,9 @@ def scan_mail_log(logger, env):
for fn in ('/var/log/mail.log.1', '/var/log/mail.log'):
if not os.path.exists(fn): continue
with open(fn) as log:
with open(fn, 'rb') as log:
for line in log:
line = line.decode("utf8", errors='replace')
scan_mail_log_line(line.strip(), collector)
if collector["imap-logins"]: