ENH+DOC: Allow setting of Epoch and TAI64N date pattern

Also add this to jail.conf man page
pull/364/head
Steven Hiscocks 2013-09-24 22:11:04 +01:00
parent e07df3f7d4
commit 9c61adcad7
2 changed files with 11 additions and 2 deletions

View File

@ -28,7 +28,7 @@ from failmanager import FailManager
from ticket import FailTicket from ticket import FailTicket
from jailthread import JailThread from jailthread import JailThread
from datedetector import DateDetector from datedetector import DateDetector
from datetemplate import DatePatternRegex, DateISO8601 from datetemplate import DatePatternRegex, DateISO8601, DateEpoch, DateTai64n
from mytime import MyTime from mytime import MyTime
from failregex import FailRegex, Regex, RegexException from failregex import FailRegex, Regex, RegexException
@ -199,9 +199,15 @@ class Filter(JailThread):
def setDatePattern(self, pattern): def setDatePattern(self, pattern):
dateDetector = DateDetector() dateDetector = DateDetector()
if pattern == "ISO8601": if pattern.upper() == "ISO8601":
template = DateISO8601() template = DateISO8601()
template.setName("ISO8601") template.setName("ISO8601")
elif pattern.upper() == "EPOCH":
template = DateEpoch()
template.setName("Epoch")
elif patter.upper() == "TAI64N":
template = DateTai64n()
template.setName("TAI64N")
else: else:
template = DatePatternRegex() template = DatePatternRegex()
if pattern[0] == "^": # Special extra to enable anchor if pattern[0] == "^": # Special extra to enable anchor

View File

@ -183,6 +183,9 @@ The following are acceptable format fields (see strptime(3) for descriptions):
.nf .nf
%% %a %A %b %B %d %H %I %j %m %M %p %S %U %w %W %y %Y %% %a %A %b %B %d %H %I %j %m %M %p %S %U %w %W %y %Y
.fi .fi
.br
Also, special values of \fIEpoch\fR (UNIX Timestamp), \fITAI64N\fR and \fIISO8601\fR can be used.
.TP .TP
\fBjournalmatch\fR \fBjournalmatch\fR
specifies the systemd journal match used to filter the journal entries. See \fBjournalctl(1)\fR and \fBsystemd.journal-fields(7)\fR for matches syntax and more details on special journal fields. This option is only valid for the \fIsystemd\fR backend. specifies the systemd journal match used to filter the journal entries. See \fBjournalctl(1)\fR and \fBsystemd.journal-fields(7)\fR for matches syntax and more details on special journal fields. This option is only valid for the \fIsystemd\fR backend.