我只想显示那些与图片文件无关的请求(例如.png
和.jpg
文件)。我尝试在自定义日志字段中使用正则表达式:
LogFormat "%h %l %u %t \"%r\/^((?!png).)*$/s" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
然而它没有用。
答案 0 :(得分:0)
您无法使用LogFormat
指令,而是使用CustomLog
:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
SetEnvIf Request_URI \.(gif|png)$ is-image
CustomLog "/path/to/logs/requests.log" combined env=!is-image