ENH: heavier debugging -- log split date/log line even for no match. Log matching regex upon match

pull/283/head
Yaroslav Halchenko 2013-07-09 12:47:41 -04:00
parent 5bd186b854
commit 148cbd8d2a
2 changed files with 6 additions and 4 deletions

View File

@ -50,7 +50,8 @@ class Regex:
except sre_constants.error:
raise RegexException("Unable to compile regular expression '%s'" %
regex)
def __str__(self):
return "%s(%r)" % (self.__class__.__name__, self._regex)
##
# Gets the regular expression.
#

View File

@ -294,7 +294,7 @@ class Filter(JailThread):
l = line
l = l.rstrip('\r\n')
logSys.log(5, "Working on line %r", l)
logSys.log(7, "Working on line %r", l)
timeMatch = self.dateDetector.matchTime(l)
if timeMatch:
# Lets split into time part and log part of the line
@ -349,19 +349,20 @@ class Filter(JailThread):
# @return a dict with IP and timestamp.
def findFailure(self, timeLine, logLine, returnRawHost=False):
logSys.log(5, "Date: %r, message: %r", timeLine, logLine)
failList = list()
# Checks if we must ignore this line.
if self.ignoreLine(logLine):
# The ignoreregex matched. Return.
logSys.log(7, "Matched ignoreregex and was ignored")
return failList
# Iterates over all the regular expressions.
for failRegex in self.__failRegex:
failRegex.search(logLine)
if failRegex.hasMatched():
# The failregex matched.
logSys.log(7, "Matched %s", failRegex)
date = self.dateDetector.getUnixTime(timeLine)
logSys.log(7, "Date: %r, message: %r",
timeLine, logLine)
if date is None:
logSys.debug("Found a match for %r but no valid date/time "
"found for %r. Please file a detailed issue on"