【问题标题】:logging proxy activity in nginx在 nginx 中记录代理活动
【发布时间】:2012-04-12 11:24:07
【问题描述】:

我正在使用 rewrite 和 proxy_pass,但我代理的网站也遇到了一些间歇性问题,说重写。有没有办法记录代理活动以便我可以调试这个问题?

【问题讨论】:

    标签: logging proxy nginx rewrite


    【解决方案1】:

    我不是专家,但在这里遇到了与我在 nginx.conf 中所做的相同的问题:

    log_format upstreamlog '[$time_local] $remote_addr - $remote_user - $server_name to: $upstream_addr: $request upstream_response_time $upstream_response_time msec $msec request_time $request_time';
    
    access_log  /var/log/nginx/access.log upstreamlog;
    

    第一行定义一个新格式,然后你告诉 access_log 使用它

    【讨论】:

    • 等等,这是否也改变了默认的access.log?我需要在代理/上游位置中定义它吗?
    • @Xeoncross log_format 必须在http {} 部分中,但是您可以在location 块内定义access_log 指令(参见context)。
    • 我将 jenkins.conf 建立在官方文档上,但这些变量总是无效的。请你看看这个要点好吗? gist.github.com/tuxerrante/b417d54eabc7a870c3bbb97dc9494420
    猜你喜欢
    • 2013-07-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-10
    • 2019-09-02
    • 1970-01-01
    相关资源
    最近更新 更多