System keeps login history events forever by default -- override in config
This commit is contained in:
parent
e8e9df767f
commit
322274a115
|
@ -923,6 +923,12 @@ function getDefaultConfig() {
|
|||
|
||||
debug : {
|
||||
assertsEnabled : false,
|
||||
},
|
||||
|
||||
statLog : {
|
||||
systemEvents : {
|
||||
loginHistoryMax: -1 // forever
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ const clientConnections = require('./client_connections.js').clientConnections;
|
|||
const StatLog = require('./stat_log.js');
|
||||
const logger = require('./logger.js');
|
||||
const Events = require('./events.js');
|
||||
const Config = require('./config.js').get;
|
||||
|
||||
// deps
|
||||
const async = require('async');
|
||||
|
@ -86,12 +87,12 @@ function userLogin(client, username, password, cb) {
|
|||
return StatLog.incrementUserStat(user, 'login_count', 1, callback);
|
||||
},
|
||||
function recordLoginHistory(callback) {
|
||||
const LOGIN_HISTORY_MAX = 200; // history of up to last 200 callers
|
||||
const loginHistoryMax = Config().statLog.systemEvents.loginHistoryMax;
|
||||
const historyItem = JSON.stringify({
|
||||
userId : user.userId,
|
||||
sessionId : user.sessionId,
|
||||
});
|
||||
return StatLog.appendSystemLogEntry('user_login_history', historyItem, LOGIN_HISTORY_MAX, StatLog.KeepType.Max, callback);
|
||||
return StatLog.appendSystemLogEntry('user_login_history', historyItem, loginHistoryMax, StatLog.KeepType.Max, callback);
|
||||
}
|
||||
],
|
||||
err => {
|
||||
|
|
Loading…
Reference in New Issue