nginxnginx-location

Are location specific logfiles treated different?


I am using nginx to access various services on a machine. Therefor I added specific logfiles for each proxied service:

location /errorcodes/ {
  include /etc/nginx/sinatra_params;
  proxy_pass http://localhost:4567/;
  access_log /var/log/nginx/errorcodes-access.log;
  error_log /var/log/nginx/errorcodes-error.log;
}

Now it seems that location specific logfiles are treated different than the global logfiles, for the owner and group and also the access rights differ to those from the global nginx logfiles.

contents of /var/log/nginx

I don't think that's such a big problem, but I would like to understand what's going on here. So why are the location specific logfiles treated different.


Solution

  • access.log and error.log already had been rotated by logrotate.
    /etc/logrotate.d/nginx contains the line create 0640 www-data adm so rotating the logs by logrotate re-creates the files with differing owner, group and mode.