mirror of https://github.com/fail2ban/fail2ban
python 3.x compatibility: fix replacement string (may fail with errors like `bad escape \d ...`, etc)
parent
442b0b1c59
commit
3e8098d427
|
@ -204,7 +204,7 @@ class DateEpoch(DateTemplate):
|
|||
self.name = "LongEpoch";
|
||||
epochRE = r"\d{10,11}(?:\d{3}(?:\d{3})?)?"
|
||||
if pattern:
|
||||
regex = RE_EPOCH_PATTERN.sub("(%s)" % epochRE, pattern)
|
||||
regex = RE_EPOCH_PATTERN.sub(lambda v: "(%s)" % epochRE, pattern)
|
||||
self.setRegex(regex)
|
||||
elif not lineBeginOnly:
|
||||
regex = r"((?:^|(?P<square>(?<=^\[))|(?P<selinux>(?<=\baudit\()))%s)(?:(?(selinux)(?=:\d+\)))|(?(square)(?=\])))" % epochRE
|
||||
|
|
Loading…
Reference in New Issue