Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex count (stats) and reorder (rise up) mechanism #3007

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

sebres
Copy link
Contributor

@sebres sebres commented Apr 17, 2021

  • regex of multiple failregex (and ignoreregex) can rise up in filter depending on numer of matched lines,
    (most used expressions go to the begin of list so will be applied first) what can provide better performance by
    match search; two new option allow to switch this behavior for single or any expression:
    • NO-RISE-UP or NoRiseUp - disable rising up for the regex for which this option is set
    • NO-REORDER or NoReorder - disable reordering of failregex or ignoreregex list completely
  • fail2ban-regex extended:
    • prefregex, failregex and ignoreregex are showing as original pattern now and PCRE expression
      only in verbose mode (and all patterns are reordered by number of matches now);
    • new option --verbose-regex or --VR which show substituted PCRE expression of prefregex,
      matched failregex and ignoreregex additionally to pattern (without the need to enable more verbose mode)
  • fail2ban-regex and test suite e. g. sample regexs factory are adjusted to use more common functionality
    of filter module (fewer special tweaks inside the modules);
  • performance improvements, simplifying code base and new test cases covering new concerns
  • can help to implement some statistic (e. g. part of [RFE]: Offending line-logger #2972)
  • new regex options feature can be used to implement more regex-related tweaks, for example define a subnet size per regex (like [RFE]: Log file line pre-processing #2992) etc;

sebres and others added 6 commits March 25, 2021 12:19
…facilities (rise up most used regex to speedup scan by multiple list)
… and more precise as old RegexStat by indices), regex list can be reordered now, so target REs by indices is not valid anymore.
…per default original pattern only, in verbose output interpolated RE);

new parameter `--verbose-regex` or `--VR` to force output of RE in non-verbose mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants