如何在 uwsgi 日志中添加 HTTP header
How to add HTTP header in uwsgi logs
我有一个 nginx
作为代理,uWSGI
作为应用服务器。我想将任何 http headers 添加到 uwsgi 日志。我可以在日志中添加一些 var.VAR_NAME
。
通过文档 (http://uwsgi-docs.readthedocs.io/en/latest/LogFormat.html):
%(var.XXX) -> the content of request variable XXX (like var.PATH_INFO, available from
1.9.21)
但这只适用于来自 nginx 的 uwsgi_param
,不适用于 proxy_set_header
或 smt。像这样。
我在 uwsgi
github 个问题中找到了答案 - https://github.com/unbit/uwsgi/issues/1407#issuecomment-326605267 and updated the docs (http://uwsgi-docs.readthedocs.io/en/latest/LogFormat.html):
%(var.XXX) -> the content of request variable XXX (like var.PATH_INFO
or var.HTTP_X_MY_HEADER for headers from request, available from
1.9.21)
我有一个 nginx
作为代理,uWSGI
作为应用服务器。我想将任何 http headers 添加到 uwsgi 日志。我可以在日志中添加一些 var.VAR_NAME
。
通过文档 (http://uwsgi-docs.readthedocs.io/en/latest/LogFormat.html):
%(var.XXX) -> the content of request variable XXX (like var.PATH_INFO, available from 1.9.21)
但这只适用于来自 nginx 的 uwsgi_param
,不适用于 proxy_set_header
或 smt。像这样。
我在 uwsgi
github 个问题中找到了答案 - https://github.com/unbit/uwsgi/issues/1407#issuecomment-326605267 and updated the docs (http://uwsgi-docs.readthedocs.io/en/latest/LogFormat.html):
%(var.XXX) -> the content of request variable XXX (like var.PATH_INFO or var.HTTP_X_MY_HEADER for headers from request, available from 1.9.21)