Fix logs view in superuser panel
This seems to have been broken ever since we moved to syslog
This commit is contained in:
parent
92c0a05ec1
commit
33b31a2451
2 changed files with 5 additions and 5 deletions
|
@ -204,8 +204,8 @@ class DefaultConfig(object):
|
||||||
|
|
||||||
# System logs.
|
# System logs.
|
||||||
SYSTEM_LOGS_PATH = "/var/log/"
|
SYSTEM_LOGS_PATH = "/var/log/"
|
||||||
SYSTEM_SERVICE_LOGS_PATH = "/var/log/%s/current"
|
SYSTEM_LOGS_FILE = "/var/log/syslog"
|
||||||
SYSTEM_SERVICES_PATH = "conf/init/"
|
SYSTEM_SERVICES_PATH = "conf/init/service/"
|
||||||
|
|
||||||
# Services that should not be shown in the logs view.
|
# Services that should not be shown in the logs view.
|
||||||
SYSTEM_SERVICE_BLACKLIST = []
|
SYSTEM_SERVICE_BLACKLIST = []
|
||||||
|
|
|
@ -47,14 +47,14 @@ class SuperUserGetLogsForService(ApiResource):
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(app.config['SYSTEM_SERVICE_LOGS_PATH'] % service, 'r') as f:
|
with open(app.config['SYSTEM_LOGS_FILE'], 'r') as f:
|
||||||
logs = f.read()
|
logs = f.readlines()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logger.exception('Cannot read logs')
|
logger.exception('Cannot read logs')
|
||||||
abort(400)
|
abort(400)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'logs': logs
|
'logs': '\n'.join([log for log in logs if log.find(service + '[') >= 0])
|
||||||
}
|
}
|
||||||
|
|
||||||
abort(403)
|
abort(403)
|
||||||
|
|
Reference in a new issue