如何停用 nginx 向系統日誌發送訊息?

如何停用 nginx 向系統日誌發送訊息?

我的 nginx 向系統日誌發送了大量訊息,但我不需要它們。在我的 nginx.conf 中:

      error_log  /var/log/nginx-error.log  notice;
        ......
      server {
      access_log  off;
      location /
      {
         .... 
        }
      }

但是,在我/var/log/message 看來

Nov 22 23:25:09 cache3 nginx: 2011/11/22 23:25:09 [error] 3437#0: *32172530         kevent() reported about an closed connection (60: Operation timed out) while reading response header from upstream, client: , server: , request: "GET http://www.igoido012.com//vk HTTP/1.1", upstream: "http:////vk", host: "www.igoido012.com", referrer: "http://www.baidu.com/"
Nov 22 23:25:09 cache3 nginx: 2011/11/22 23:25:09 [error] 3437#0: *32099531 upstream timed out (60: Operation timed out) while reading response header from upstream, client: , server: , request: "GET http://t.web2.qq.com/channel/poll?msg_id=0&clientid=431509&t=1321975433305 HTTP/1.1", upstream: "http://:80/channel/poll?msg_id=0&clientid=431509&t=1321975433305", host: "t.web2.qq.com", referrer: "http://t.web2.qq.com/proxy.html?v=20110331001"

如何防止 nginx 傳送訊息給我的系統日誌?

答案1

我不知道 nginx 會在不打補丁的情況下發送到 syslog:

http://wiki.nginx.org/3rdPartyModules#Third_party_patches

所以,我假設您有一個自訂建置的 nginx。查看補丁來源以取得有關如何配置的提示:

https://github.com/yaoweibin/nginx_syslog_patch

如果您直接執行 nginx,那麼還有其他方法可以將這些日誌條目放入 syslog 中。

相關內容