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
1 changed files with 2 additions and 1 deletions

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"]: