diff --git a/endpoints/api/superuser.py b/endpoints/api/superuser.py index e6923c854..515a66b7d 100644 --- a/endpoints/api/superuser.py +++ b/endpoints/api/superuser.py @@ -3,6 +3,7 @@ import json import logging import os import string +import socket import pathvalidate @@ -101,6 +102,7 @@ class SuperUserGetLogsForService(ApiResource): abort(400) return { + 'instance': socket.gethostname(), 'logs': '\n'.join(logs) } @@ -121,6 +123,7 @@ class SuperUserSystemLogServices(ApiResource): """ List the system logs for the current system. """ if SuperUserPermission().can(): return { + 'instance': socket.gethostname(), 'services': list(get_services()) } diff --git a/static/js/pages/superuser.js b/static/js/pages/superuser.js index d8b02051b..6663b9335 100644 --- a/static/js/pages/superuser.js +++ b/static/js/pages/superuser.js @@ -18,10 +18,12 @@ // Monitor any user changes and place the current user into the scope. UserService.updateUserIn($scope); + $scope.multipleInstances = false; $scope.configStatus = null; $scope.requiresRestart = null; $scope.logsCounter = 0; $scope.changeLog = null; + $scope.logsInstance = null; $scope.debugServices = null; $scope.debugLogs = null; $scope.pollChannel = null; @@ -83,6 +85,13 @@ }); ApiService.getSystemLogs(null, params, /* background */true).then(function(resp) { + if ($scope.logsInstance != null && $scope.logsInstance != resp['instance']) { + $scope.multipleInstances = true; + callback(false); + return; + } + + $scope.logsInstance = resp['instance']; $scope.debugLogs = resp['logs']; callback(true); }, errorHandler); @@ -96,6 +105,13 @@ $scope.debugService = null; ApiService.listSystemLogServices().then(function(resp) { + if ($scope.logsInstance != null && $scope.logsInstance != resp['instance']) { + $scope.multipleInstances = true; + callback(false); + return; + } + + $scope.logsInstance = resp['instance']; $scope.debugServices = resp['services']; }, ApiService.errorDisplay('Cannot load system logs. Please contact support.')) }; diff --git a/static/partials/super-user.html b/static/partials/super-user.html index d8f7d2154..6b74febd6 100644 --- a/static/partials/super-user.html +++ b/static/partials/super-user.html @@ -87,27 +87,31 @@ -
+
+ Debug logs cannot be displayed as is running under multiple containers. To retrieve logs, please use your implementation's custom configured logging solution. +
+
+
+
+ + -
- - +
+ Select a service above to view its local logs -
- Select a service above to view its local logs - - +
-