如何过滤NGINX access.log“生成”

如何过滤NGINX access.log“生成”

有没有办法告诉 NGINX 不要将某些信息生成到访问日志中?

我已经安装了 Cometchat 并每 x 毫秒轮询一次,这是没问题的,但是我怎样才能跳过写入访问日志中的那些调用呢?

以下是一个示例:

83.57.184.215 - - [10/Mar/2011:20:51:51 +0000] "GET /images/sidebarTitle.png HTTP/1.1" 200 405 "http://www.fictioncity.net/css/fictioncity.css" "Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15"
83.57.184.215 - - [10/Mar/2011:20:51:51 +0000] "GET /usermedia/0/3/thumb/3/15fd587c25469a8e9c285dba1711b8eeedf8c68b93bd33ba5e0b8daaff565162.jpg HTTP/1.1" 200 4369 "http://www.fictioncity.net/whatsup?l=es" "Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15"
83.57.184.215 - - [10/Mar/2011:20:51:51 +0000] "GET /images/fc-ny/banner-FC-NY.jpg HTTP/1.1" 200 98571 "http://www.fictioncity.net/whatsup?l=es" "Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15"
83.57.184.215 - - [10/Mar/2011:20:51:51 +0000] "GET /css/jqueryui/fc/images/ui-bg_flat_75_ffffff_40x100.png HTTP/1.1" 304 0 "http://www.fictioncity.net/css/jqueryui/fc/jquery-ui.css" "Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15"
83.57.184.215 - - [10/Mar/2011:20:51:51 +0000] "GET /cometchat/themes/default/images/bgrepeat.png HTTP/1.1" 304 0 "http://www.fictioncity.net/cometchat/cometchatcss.php" "Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15"
83.57.184.215 - - [10/Mar/2011:20:51:51 +0000] "GET /cometchat/themes/default/images/hide.png HTTP/1.1" 304 0 "http://www.fictioncity.net/cometchat/cometchatcss.php" "Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15"
83.57.184.215 - - [10/Mar/2011:20:51:51 +0000] "GET /cometchat/themes/default/images/cometchat.png HTTP/1.1" 304 0 "http://www.fictioncity.net/cometchat/cometchatcss.php" "Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15"
83.57.184.215 - - [10/Mar/2011:20:51:51 +0000] "GET /images/avatar_female_p.png HTTP/1.1" 200 15010 "http://www.fictioncity.net/whatsup?l=es" "Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15"
83.57.184.215 - - [10/Mar/2011:20:51:52 +0000] "POST /cometchat/cometchat_receive.php HTTP/1.1" 200 22 "http://www.fictioncity.net/whatsup?l=es" "Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15"
200.55.213.162 - - [10/Mar/2011:20:51:52 +0000] "POST /cometchat/cometchat_receive.php HTTP/1.1" 200 22 "http://fictioncity.net/image/show?image=3431&key=dcd12f7d55b1448db788ac8e76d508b7&l=es" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13"
83.57.184.215 - - [10/Mar/2011:20:51:56 +0000] "POST /cometchat/cometchat_receive.php HTTP/1.1" 200 22 "http://www.fictioncity.net/whatsup?l=es" "Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15"
186.109.23.106 - - [10/Mar/2011:20:51:56 +0000] "POST /cometchat/cometchat_receive.php HTTP/1.1" 200 22 "http://www.fictioncity.net/whatsup?l=es" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.127 Safari/534.16"
200.123.146.83 - - [10/Mar/2011:20:51:57 +0000] "POST /cometchat/cometchat_receive.php HTTP/1.1" 200 22 "http://www.fictioncity.net/site/mainpage?view=itau" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.16pre) Gecko/20110308 Ubuntu/10.10 (maverick) Namoroka/3.6.16pre"
200.117.89.165 - - [10/Mar/2011:20:51:58 +0000] "POST /cometchat/cometchat_receive.php HTTP/1.1" 200 22 "http://www.fictioncity.net/resume/edit?l=es" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13"

答案1

使用单独的子规则:

location ~* /cometchat/ {
  access_log off;
}

相关内容