From: Costa Tsaousis Date: Wed, 15 Feb 2017 07:23:40 +0000 (+0200) Subject: Merge pull request #1791 from elopio/patch-1 X-Git-Tag: ab-debian_0.20170221.01-0ab1~1^2~11 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9dc0bf35a165c6ccae783ad21b3b09282f45f56c;hp=ae65da2c54802db49bdef84acbbd860e4da90838;p=netdata.git Merge pull request #1791 from elopio/patch-1 fix typo in the installer help --- diff --git a/python.d/web_log.chart.py b/python.d/web_log.chart.py index 9119c9dc..43abdf03 100644 --- a/python.d/web_log.chart.py +++ b/python.d/web_log.chart.py @@ -128,12 +128,21 @@ class Service(LogService): logs.seek(-2, 1) if logs.tell() == 0: break - last_line = logs.readline().decode(encoding='utf-8') + last_line = logs.readline() + + try: + last_line = last_line.decode() + except UnicodeDecodeError: + try: + last_line = last_line.decode(encoding='utf-8') + except (TypeError, UnicodeDecodeError) as error: + self.error(str(error)) + return False # Parse last line regex_name = self.find_regex(last_line) if not regex_name: - self.error('Can\'t parse %s' % self.log_path) + self.error('Unknown log format. Can\'t parse %s' % self.log_path) return False if regex_name.startswith('acs_'):