add:新增任务、指令、系统日志、acs日志清理
This commit is contained in:
@@ -7,6 +7,9 @@ import org.nl.acs.config.server.AcsConfigService;
|
|||||||
import org.nl.wql.core.bean.WQLObject;
|
import org.nl.wql.core.bean.WQLObject;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自动清除日志(操作日志、异常日志)数据
|
* 自动清除日志(操作日志、异常日志)数据
|
||||||
*/
|
*/
|
||||||
@@ -16,11 +19,20 @@ import org.springframework.stereotype.Component;
|
|||||||
public class CleanAcsLog {
|
public class CleanAcsLog {
|
||||||
private final AcsConfigService acsConfigService;
|
private final AcsConfigService acsConfigService;
|
||||||
|
|
||||||
public void run(){
|
public void run() {
|
||||||
//delete from acs_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10;
|
//delete from acs_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10;
|
||||||
WQLObject logTab = WQLObject.getWQLObject("acs_log");
|
log.info("开始打印日志");
|
||||||
int days = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.AutoCleanDays));
|
int days = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.AutoCleanDays));
|
||||||
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
|
List<String> list = new ArrayList<String>();
|
||||||
log.info("自动清理acs日志执行成功...!");
|
list.add("acs_log");
|
||||||
|
list.add("sys_log");
|
||||||
|
list.add("acs_task");
|
||||||
|
list.add("acs_instruction");
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
String sys = list.get(i);
|
||||||
|
WQLObject logTab = WQLObject.getWQLObject(sys);
|
||||||
|
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
|
||||||
|
log.info("自动清理" + sys + "日志执行成功...!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user