From 7320ba0e6d217c16e244c1a62745b83fac402f54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Fri, 2 Mar 2018 18:09:12 +0100 Subject: [PATCH] Added to "use" log the serviceName & the pool name --- server/src/uds/core/osmanagers/BaseOsManager.py | 4 ++-- server/src/uds/core/util/log.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/server/src/uds/core/osmanagers/BaseOsManager.py b/server/src/uds/core/osmanagers/BaseOsManager.py index 61e1db48d..85797d0b5 100644 --- a/server/src/uds/core/osmanagers/BaseOsManager.py +++ b/server/src/uds/core/osmanagers/BaseOsManager.py @@ -209,7 +209,7 @@ class OSManager(Module): log.doLog(userService, log.INFO, "User {0} has logged in".format(userName), log.OSMANAGER) - log.useLog('login', uniqueId, serviceIp, userName, knownUserIP, fullUserName) + log.useLog('login', uniqueId, serviceIp, userName, knownUserIP, fullUserName, userService.friendly_name, userService.deployed_service.name) counter = int(userService.getProperty('loginsCounter', '0')) + 1 userService.setProperty('loginsCounter', six.text_type(counter)) @@ -255,7 +255,7 @@ class OSManager(Module): log.doLog(userService, log.INFO, "User {0} has logged out".format(userName), log.OSMANAGER) - log.useLog('logout', uniqueId, serviceIp, userName, knownUserIP, fullUserName) + log.useLog('logout', uniqueId, serviceIp, userName, knownUserIP, fullUserName, userService.friendly_name, userService.deployed_service.name) if save: userService.save() diff --git a/server/src/uds/core/util/log.py b/server/src/uds/core/util/log.py index 6043b94ee..5d6a288b6 100644 --- a/server/src/uds/core/util/log.py +++ b/server/src/uds/core/util/log.py @@ -73,7 +73,7 @@ def logStrFromLevel(level): return __valueLevels.get(level, 'OTHER') -def useLog(type_, serviceUniqueId, serviceIp, username, srcIP=None, srcUser=None): +def useLog(type_, serviceUniqueId, serviceIp, username, srcIP=None, srcUser=None, userServiceName=None, poolName=None): ''' Logs an "use service" event (logged from actors) :param type_: Type of event (commonly 'login' or 'logout' ) @@ -85,7 +85,10 @@ def useLog(type_, serviceUniqueId, serviceIp, username, srcIP=None, srcUser=None ''' srcIP = 'unknown' if srcIP is None else srcIP srcUser = 'unknown' if srcUser is None else srcUser - useLogger.info('|'.join([type_, serviceUniqueId, serviceIp, srcIP, srcUser, username])) + userServiceName = 'unknown' if userServiceName is None else userServiceName + poolName = 'unknown' if poolName is None else poolName + + useLogger.info('|'.join([type_, serviceUniqueId, serviceIp, srcIP, srcUser, username, userServiceName, poolName])) def doLog(wichObject, level, message, source=UNKNOWN, avoidDuplicates=True):