def validate_log_date(self, line):
delta = timedelta(hours=2)
m = REG_GENERAL_ERR.match(line)
if m:
log_time = datetime.strptime(m.group(1), "%Y-%m-%d %H:%M:%S")
log_time = log_time.replace(tzinfo=tz.tzutc()).astimezone(zoneinfo.gettz(self._GENERAL_CONFIG["TIMEZONE"]))
log_time = log_time.replace(tzinfo=None)
if (self._now - log_time) > delta:
return False
elif BEGIN_DEADLOCK in line:
m = REG_DEADLOCK.match(line)
log_time = datetime.strptime(m.group(1), "%Y-%m-%d %H:%M:%S")
log_time = log_time.replace(tzinfo=tz.tzutc()).astimezone(zoneinfo.gettz(self._GENERAL_CONFIG["TIMEZONE"]))
log_time = log_time.replace(tzinfo=None)
if (self._now - log_time) > delta:
return False
return True
评论列表
文章目录