I have a question about how 301 entries are logged. A bit of background:
I created a new server in Forge and added a site. By default, NGINX logs to
In Forge, I edited the site conf to go from this:
access_log off; error_log /var/log/nginx/www.foo.com-error.log error;
#access_log off; error_log /var/log/nginx/www.foo.com-error.log error; access_log /var/log/nginx/www.foo.com-access.log;
At this point, I am getting a separate access log for each individual site. This is what I want, but the problem is that 301 entries are still being logged in the default access log.
06/Dec/2019:16:54:28 +0000 - 18.104.22.168 - www.foo.com - GET / HTTP/1.1 - 301 - 169 - - - Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362 - 22.214.171.124
Is being logged to
/var/log/nginx/access.log instead of
I'd like to do two things, but I don't know how:
#1 Make sure that anything related to www.foo.com is being logged to the foo.com-access file including 301 entries.
#2 Add a field to the
log_format that shows where the request is redirecting to (not just the referrer from) in the log.
Can anyone help with this?