Fail2ban Filter Generator
Build a Fail2ban filter with failregex to detect intrusion attempts in custom logs (failed login, 401, 403).
/etc/fail2ban/filter.d/<name>.conf
—
Writing a fail2ban filter that actually matches
fail2ban reads logs, looks for lines indicating a failed attempt and bans the source address once they repeat. The filter is what does the recognising: a file holding one or more regular expressions. Writing that file is where most configurations stall, because a regex matching nothing raises no error — it simply never bans anybody.
Enter the filter name and the expressions and the page assembles the file, already carrying the path where it should be saved and the line referencing it from the jail. The detail that decides everything is the host marker: fail2ban replaces that tag with the pattern recognising IPv4 and IPv6 addresses, and that is where it takes the address to ban from. A regex without that marker matches the line but identifies nobody.
Test before shipping. fail2ban's test command takes a log file and a filter and reports how many lines matched and which addresses were extracted — it is the difference between finding the mistake now or three weeks from now, when someone asks why nobody was ever banned. It also pays to take ignoreregex seriously so you do not ban yourself: monitoring and health checks produce exactly the kind of line the filter looks for.
Frequently asked questions
How do I test a filter without waiting for an attack?
Why is the host marker mandatory?
Are a filter and a jail the same thing?
Related Tools
CSS Glassmorphism Generator
Create frosted-glass effects with backdrop-filter, transparency and borders. Adjust blur, saturation and opacity. Live preview and copy-ready CSS. Everything in your browser.
CSS Specificity Calculator
Compute the specificity (a, b, c) of a CSS selector — IDs, classes/attributes/pseudo-classes, elements. Useful to understand why your rule is not applying. Everything in your browser.
Icon Finder
Search SVG icons from the Lucide library (1300+ icons) by name. Copy the SVG or component name.
VS Code Snippet Generator
Build a JSON snippet ready to paste into VS Code *.code-snippets files, with prefix, multi-line body and tabstops $1, $2.
JWT Decoder Verbose
Decodes the header and payload of a JWT without verifying the signature, explains each registered claim and turns exp, nbf and iat into readable dates.
Tailwind Config CLI Generator
Generate a ready-to-use tailwind.config.js for the Tailwind CLI, with content paths and theme set up. Copy it and start styling in seconds.