1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-10 01:17:59 +03:00

Added to "use" log the serviceName & the pool name

This commit is contained in:
Adolfo Gómez García 2018-03-02 18:09:12 +01:00
parent 4271be9340
commit 7320ba0e6d
2 changed files with 7 additions and 4 deletions

View File

@ -209,7 +209,7 @@ class OSManager(Module):
log.doLog(userService, log.INFO, "User {0} has logged in".format(userName), log.OSMANAGER) 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 counter = int(userService.getProperty('loginsCounter', '0')) + 1
userService.setProperty('loginsCounter', six.text_type(counter)) 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.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: if save:
userService.save() userService.save()

View File

@ -73,7 +73,7 @@ def logStrFromLevel(level):
return __valueLevels.get(level, 'OTHER') 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) Logs an "use service" event (logged from actors)
:param type_: Type of event (commonly 'login' or 'logout' ) :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 srcIP = 'unknown' if srcIP is None else srcIP
srcUser = 'unknown' if srcUser is None else srcUser 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): def doLog(wichObject, level, message, source=UNKNOWN, avoidDuplicates=True):