通过HTTP方法路由uwsgi日志(HEAD / GET / etc)

时间:2017-08-02 16:47:29

标签: uwsgi

我在nginx后面使用uwsgi,由monit监控。

Monit通过(默认情况下)发送HEAD / HTTP/1.1请求来检查网站的状态。这工作正常,但我最终在日志文件中包含了很多这些行:

[pid: 28317|app: 0|req: 1/1] xxx.ip.addr.xxx () {34 vars in 366 bytes} [Wed Aug  2 16:17:58 2017] HEAD / => generated 0 bytes in 13 msecs (HTTP/1.1 200) 2 headers in 81 bytes (0 switches on core 0)

看起来log-routelog-req-route就是为此设计的,请参阅the docsother questions on this site,但我似乎无法将HEAD请求路由到自己的文件。

我的uwsgi.ini:

# Log Monit pings separately
req-logger = monitrequests file:uwsgi-monitrequests.log                                                

# All other requests         
req-logger = file:uwsgi-requests.log

# Everything else
logger = file:uwsgi.log                     

log-req-route = monitrequests .*HEAD.*

所有记录的请求都以uwsgi-requests.log结束。

一个解决办法可能是让Monit探测健康检查网址(例如my.site/heartbeat)并根据具有uwsgi路线,有没有更好的选择?

0 个答案:

没有答案