mirror of https://github.com/fail2ban/fail2ban
comments/notes on relevant places
parent
b257be4cd1
commit
dcc35a0fab
|
@ -167,6 +167,15 @@ class DateDetector:
|
||||||
def getTime(self, line):
|
def getTime(self, line):
|
||||||
self.__lock.acquire()
|
self.__lock.acquire()
|
||||||
try:
|
try:
|
||||||
|
# TODO: collect all matches and choose the one most
|
||||||
|
# appropriate
|
||||||
|
# TODO (OPT): make it smarter and converging
|
||||||
|
# on 1 specific pattern for each jail/file
|
||||||
|
# so we don't need to cycle all over again and again
|
||||||
|
# wasting cpu cycles and possibly confusing multiple
|
||||||
|
# matching patterns (might need to be an option, if
|
||||||
|
# someone wants to monitor some file without strict
|
||||||
|
# date pattern -- are there such?)
|
||||||
for template in self.__templates:
|
for template in self.__templates:
|
||||||
try:
|
try:
|
||||||
date = template.getDate(line)
|
date = template.getDate(line)
|
||||||
|
|
|
@ -61,7 +61,12 @@ class DateTemplate:
|
||||||
return self.__hits
|
return self.__hits
|
||||||
|
|
||||||
def matchDate(self, line):
|
def matchDate(self, line):
|
||||||
|
# TODO be more aggressive and match optional ms
|
||||||
dateMatch = self.__cRegex.search(line)
|
dateMatch = self.__cRegex.search(line)
|
||||||
|
# XXX also now for each matching dateline it would be
|
||||||
|
# invoked twice since in filter.py:284 processLine
|
||||||
|
# it first matches time to discover its string location
|
||||||
|
# and then it processes it to obtain actual time
|
||||||
if not dateMatch == None:
|
if not dateMatch == None:
|
||||||
self.__hits += 1
|
self.__hits += 1
|
||||||
return dateMatch
|
return dateMatch
|
||||||
|
|
Loading…
Reference in New Issue