基本 Apache 日志正则表达式

基本 Apache 日志正则表达式

我正在努力failregex使用 HTTP 返回代码匹配 Apache 日志上的 Fail2Ban。我使用的日志格式如下,在该示例中,字段显示“200”。只要其他字段(采用该格式)可以是任何其他内容,那么我感兴趣的就是该字段。

66-121-89-14.domain.com - - [14/Apr/2011:14:47:05 +0100] "GET /city/index.html HTTP/1.1" 200 2577 "http://www.domain.com/referrer/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16"

思考我需要这样的东西。

failregex = ^(?P<host>\S*).*("-" "-"| 502 | 500 | 417 | 416 | 415 | 414 | 413 | 412 | 405 | 403 |

正则表达式爱好者可以帮忙吗?

答案1

这是怎么办呢?

<HOST>.*\" (500|502|...)

相关内容