summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/python_modules/bases
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-21 19:34:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-21 19:34:08 +0000
commit6d2e027eb728c8294fdd7c3692e9853b3ca2603b (patch)
tree3e190253238075ac8590b2f214852d2256fdad53 /collectors/python.d.plugin/python_modules/bases
parentOpting out by default from sending anonymous statistics (phone home). (diff)
downloadnetdata-6d2e027eb728c8294fdd7c3692e9853b3ca2603b.tar.xz
netdata-6d2e027eb728c8294fdd7c3692e9853b3ca2603b.zip
Merging upstream version 1.12.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/python.d.plugin/python_modules/bases')
-rw-r--r--collectors/python.d.plugin/python_modules/bases/FrameworkServices/LogService.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/LogService.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/LogService.py
index 5acfd73f8..82c8d7d95 100644
--- a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/LogService.py
+++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/LogService.py
@@ -5,6 +5,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from glob import glob
+import sys
import os
from bases.FrameworkServices.SimpleService import SimpleService
@@ -17,6 +18,7 @@ class LogService(SimpleService):
self.__glob_path = self.log_path
self._last_position = 0
self.__re_find = dict(current=0, run=0, maximum=60)
+ self.__open_args = {'errors': 'replace'} if sys.version_info[0] > 2 else {}
def _get_raw_data(self):
"""
@@ -34,7 +36,7 @@ class LogService(SimpleService):
elif size < self._last_position:
self._last_position = 0 # read from beginning if file has shrunk
- with open(self.log_path) as fp:
+ with open(self.log_path, **self.__open_args) as fp:
fp.seek(self._last_position)
for line in fp:
lines.append(line)