#检查 正则匹配情况
[root@proxy ~]# fail2ban-regex /var/log/nginx/access.log /etc/fail2ban/filter.d/nginx.conf
Running tests
=============
Use failregex filter file : nginx, basedir: /etc/fail2ban
Use log file : /var/log/nginx/access.log
Use encoding : UTF-8
Results
=======
Failregex: 37 total
|- #) [# of hits] regular expression
| 1) [37] <HOST> - - .* 400 157 .* "-"$
`-
Ignoreregex: 0 total
Date template hits:
|- [# of hits] date format
| [125] Day(?P<_sep>[-/])MON(?P=_sep)ExYear[ :]?24hour:Minute:Second(?:\.Microseconds)?(?: Zone offset)?
`-
Lines: 125 lines, 0 ignored, 37 matched, 88 missed
[processed in 0.07 sec]
Missed line(s): too many to print. Use --print-all-missed to print all 88 lines
#查看启动服务后匹配状态
[root@proxy ~]# fail2ban-client status ssh-ip
Status for the jail: ssh-ip
|- Filter
| |- Currently failed: 0
| |- Total failed: 3
| `- File list: /var/log/secure
`- Actions
|- Currently banned: 1
|- Total banned: 1
`- Banned IP list: 192.168.120.18