mirror of https://github.com/jumpserver/jumpserver
fix: ftp日志清理bug
parent
f433b0e653
commit
95b432bfe6
|
@ -7,7 +7,7 @@ from celery import shared_task
|
||||||
from ops.celery.decorator import (
|
from ops.celery.decorator import (
|
||||||
register_as_period_task
|
register_as_period_task
|
||||||
)
|
)
|
||||||
from .models import UserLoginLog, OperateLog
|
from .models import UserLoginLog, OperateLog, FTPLog
|
||||||
from common.utils import get_log_keep_day
|
from common.utils import get_log_keep_day
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ def clean_ftp_log_period():
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
days = get_log_keep_day('FTP_LOG_KEEP_DAYS')
|
days = get_log_keep_day('FTP_LOG_KEEP_DAYS')
|
||||||
expired_day = now - datetime.timedelta(days=days)
|
expired_day = now - datetime.timedelta(days=days)
|
||||||
OperateLog.objects.filter(datetime__lt=expired_day).delete()
|
FTPLog.objects.filter(datetime__lt=expired_day).delete()
|
||||||
|
|
||||||
|
|
||||||
@register_as_period_task(interval=3600*24)
|
@register_as_period_task(interval=3600*24)
|
||||||
|
|
Loading…
Reference in New Issue