Fix logs view in superuser panel

This seems to have been broken ever since we moved to syslog
This commit is contained in:
Joseph Schorr 2015-06-15 20:55:23 -04:00
parent 92c0a05ec1
commit 33b31a2451
2 changed files with 5 additions and 5 deletions

View file

@ -204,8 +204,8 @@ class DefaultConfig(object):
# System logs.
SYSTEM_LOGS_PATH = "/var/log/"
SYSTEM_SERVICE_LOGS_PATH = "/var/log/%s/current"
SYSTEM_SERVICES_PATH = "conf/init/"
SYSTEM_LOGS_FILE = "/var/log/syslog"
SYSTEM_SERVICES_PATH = "conf/init/service/"
# Services that should not be shown in the logs view.
SYSTEM_SERVICE_BLACKLIST = []

View file

@ -47,14 +47,14 @@ class SuperUserGetLogsForService(ApiResource):
abort(404)
try:
with open(app.config['SYSTEM_SERVICE_LOGS_PATH'] % service, 'r') as f:
logs = f.read()
with open(app.config['SYSTEM_LOGS_FILE'], 'r') as f:
logs = f.readlines()
except Exception as ex:
logger.exception('Cannot read logs')
abort(400)
return {
'logs': logs
'logs': '\n'.join([log for log in logs if log.find(service + '[') >= 0])
}
abort(403)