Skip to content

catching timestamp formats? #3150

Answered by sebres
murdocklawless asked this question in Q&A
Discussion options

You must be logged in to vote

Huh?
This is default datepattern (at least in all current versions), thus 05-Oct-2021 17:09:39 +0300 should be matched without to set datepattern additionally (and [] can be matched as a part of failregex):

PoC, fail2ban-regex test default pattern
$ fail2ban-regex '[05-Oct-2021 17:09:39 +0300] 192.0.2.1' '^\s*(?:\[\]\s+)?<ADDR>'

Running tests
=============

Use   failregex line : ^\s*(?:\[\]\s+)?<ADDR>
Use      single line : [05-Oct-2021 17:09:39 +0300] 192.0.2.1


Results
=======

Failregex: 1 total
|-  #) [# of hits] regular expression
|   1) [1] ^\s*(?:\[\]\s+)?<ADDR>
`-

Ignoreregex: 0 total

Date template hits:
|- [# of hits] date format
|  [1] {^LN-BEG}Day(?P<_sep>[-/])MON(?P=_sep)…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sebres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants