Fresh install of CentOS 7 and nginx 1.6.3. Per the official documentation I set the access_log directive to forward via syslog to a remote server in /etc/nginx/nginx.conf:

#access_log /var/log/nginx/access.log   main;
access_log syslog:server=[],facility=local7,tag=nginx,severity=info;

When I restart (or start) nginx with that change, I get the following error:

[root@localhost ~]# systemctl restart nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

[root@localhost ~]# systemctl status nginx.service
nginx: [emerg] open() "/usr/share/nginx/syslog:server=[],facility=local7,tag=nginx,severity=info" failed (13: Permission denied)

It's like the service doesn't know how to parse its own config file correctly, as if the IP and options are part of a file it's trying to read from. Anyone get this working, am I missing something obvious?


You have old nginx.

Logging to syslog is available since version 1.7.1. As part of our commercial subscription logging to syslog is available since version 1.5.3.

from documentation: http://nginx.org/en/docs/syslog.html

| improve this answer | |
  • Well that would explain that. That worked, thanks! Another note is that the square brackets are only for IPv6... you can safely omit them for IPv4 addresses. – Jon Armani Aug 1 '16 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.