NGINX logging confusion

I have multiple NGINX servers running multiple vhosts and I use a program called goaccess for data usage reports and site traffic reports. I have a small config in /etc/nginx/conf.d:

log_format vhost_combined '$server_name: $remote_addr - $remote_user [$time_local] '
                          '"$request" $status $body_bytes_sent '
                          '"$http_referer" "$http_user_agent"';

access_log /var/www/combined-access.log vhost_combined;

I tested one of our sites by downloading a video file and watching the logs for GET requests to that file and noticed no traffic reported in the /var/www/combined-access.log but traffic is reported in the log file /var/log/nginx/xxxxxxxxxxxxx.access.log. Without context this should make sense, the site config should take presidence over nginx.conf. But that doesn’t explain:

  1. Why was it working until changing the log location
  2. Why are some requests for the site still getting logged in combined-access.log while all others are missing.

Additionally, commenting out the access_log line from the site config makes requests show up in the log file; however, is there a way to allow nginx to log to multiple locations without having conflicts in the configuration?

What is the base OS? Is selinux enabled?

Ubuntu Server
no selinux

who is the owner of the /var/www/ directory?

its ya boy, www-data

Looking around, a few places suggest removing the /var/log/nginx directory, but i’d rather not, rename it to nginx.bak and do a nginx -s reload command and see what happens.

nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)
it doesnt recreate the directory but it still doesnt log my test download to combined log

Error log isn’t pointed, but is kinda weird, I’d revert the changes I told you to do. For now I’ll have to continue investigating later as I am on the clock.

More importantly, is there a reliable way to get nginx to create 2 full and separate access logs?


this answers some of the trouble