Only cleanup high frequency events in eventlog

Those are currently the login events and backup
This commit is contained in:
Johannes Zellner
2016-11-18 11:32:11 +01:00
parent 7c27f01ab8
commit 552ca43175
3 changed files with 31 additions and 10 deletions

View File

@@ -105,10 +105,17 @@ function getAllPaged(action, search, page, perPage, callback) {
function cleanup(callback) {
callback = callback || NOOP_CALLBACK;
var d = new Date();
d.setDate(d.getDate() - 7); // 7 days ago
var d = new Date();
d.setDate(d.getDate() - 7); // 7 days ago
eventlogdb.delByCreationTime(d, function (error) {
// only cleanup high frequency events
var actions = [
exports.ACTION_USER_LOGIN,
exports.ACTION_BACKUP_START,
exports.ACTION_BACKUP_FINISH
];
eventlogdb.delByCreationTime(d, actions, function (error) {
if (error) return callback(new EventLogError(EventLogError.INTERNAL_ERROR, error));
callback(null);