mirror of https://github.com/fail2ban/fail2ban
ENH: elaborated debug log message about already detected failures
Now it should be evaluated only if logging mode is debug or "lower", and also should happen not only on initial detections but for every added failure. It also reports counts per each IP nowpull/154/head
parent
e6983b4f9b
commit
5ea2ab14e6
|
@ -105,8 +105,15 @@ class FailManager:
|
|||
fData.setLastReset(unixTime)
|
||||
fData.setLastTime(unixTime)
|
||||
self.__failList[ip] = fData
|
||||
logSys.debug("Currently have failures from %d IPs: %s"
|
||||
% (len(self.__failList), self.__failList.keys()))
|
||||
|
||||
if logSys.getEffectiveLevel() <= logging.DEBUG:
|
||||
# yoh: Since composing this list might be somewhat time consuming
|
||||
# in case of having many active failures, it should be ran only
|
||||
# if debug level is "low" enough
|
||||
failures_summary = ', '.join(['%s:%d' % (k, v.getRetry())
|
||||
for k,v in self.__failList.iteritems()])
|
||||
logSys.debug("Currently have failures from %d IPs (IP:count): %s"
|
||||
% (len(self.__failList), failures_summary))
|
||||
self.__failTotal += 1
|
||||
finally:
|
||||
self.__lock.release()
|
||||
|
|
Loading…
Reference in New Issue