From 33b31a2451020127d71d5a1705764105aebf96ae Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 15 Jun 2015 20:55:23 -0400 Subject: [PATCH] Fix logs view in superuser panel This seems to have been broken ever since we moved to syslog --- config.py | 4 ++-- endpoints/api/superuser.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config.py b/config.py index 645a34462..a08e48a97 100644 --- a/config.py +++ b/config.py @@ -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 = [] diff --git a/endpoints/api/superuser.py b/endpoints/api/superuser.py index 947b2a8db..d5f664aab 100644 --- a/endpoints/api/superuser.py +++ b/endpoints/api/superuser.py @@ -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)