I am using rewrite and proxy_pass and I am having some intermittent issues with the site I am proxying said rewrites too. Is there a means to log the proxy activity so I that I can debug this problem?
Asked
Active
Viewed 6.8k times
1 Answers
73
I am not an expert, but having the same problem here what I did in my 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;
The first line define a new format, and then you tell access_log to use it
-
Wait, does this change the default `access.log` too? Do I need to define this inside the proxy/upstream location? – Xeoncross Jul 14 '14 at 18:17
-
4@Xeoncross the log_format must be in the `http {}` section, however you can define the `access_log` directive inside a `location` block (see the [context](http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log)). – bufh Aug 19 '14 at 08:42
-
I'm basing my jenkins.conf on the official docs but I get these variables always void. Would you give a look at this gist please? https://gist.github.com/tuxerrante/b417d54eabc7a870c3bbb97dc9494420 – tuxErrante Feb 09 '21 at 17:59