Sourcecode in SysMgr/cleanupFunctions.js:
1: function cleanupAccesslog() {
2: var dbConn = getDBConnection("antville");
3: var dbError = dbConn.getLastError();
4: if (dbError) {
5: this.syslogs.add (new SysLog("system", null, "failed to clean up accesslog-table!", null));
6: return;
7: }
8: var threshold = new Date();
9: threshold.setDate(threshold.getDate() -2);
10: var query = "delete from AV_ACCESSLOG where ACCESSLOG_F_TEXT is null and ACCESSLOG_DATE < '" + threshold.format("yyyy-MM-dd HH:mm:ss") + "'";
11: var delRows = dbConn.executeCommand(query);
12: if (delRows)
13: this.syslogs.add (new SysLog("system", null, "removed " + delRows + " records from accesslog-table", null));
14: return;
15: }
|