# nginx vs. syslog



## uzsolt (Nov 10, 2014)

I want nginx to send logging to syslogd(). I've tried with

```
access_log  syslog:server=localhost,tag=nginx,facility=local7;
```
 in nginx.conf, restarted nginx but nothing appears in log files. What's wrong? Should I set anything in /etc/syslog.conf? I've only filters (by tag), nothing else.


----------



## uzsolt (Nov 10, 2014)

Hm, I think I'm stupid... my nginx.conf:

```
http {
  include  mime.types;
  default_type  application/octet-stream;

  error_log  syslog:server=localhost,tag=nginx-error,facility=local7;
  access_log  syslog:server=localhost,tag=nginx,facility=local7;

  sendfile  on;
  keepalive_timeout  5;
  gzip  on;
 
  server {
     ....
  }

  types {
      text/plain  log;
  }
}
```
It doesn't work for me 
Do you have maybe any additional flags in /etc/rc.conf?


----------



## uzsolt (Nov 11, 2014)

No, I've already logfiles. And I'm logging everything (without using filters) into /var/log/everything.log too and doesn't appear log messages from `nginx`.
I've tried set another nginx-logfile in syslog.conf, but same result.


----------



## SirDice (Nov 11, 2014)

Try this:

```
http {
   access_log syslog:server=unix:/var/run/syslogd.sockets;
}
```


----------



## uzsolt (Nov 11, 2014)

SirDice said:


> Try this:
> 
> ```
> http {
> ...


It doesn't work:

```
nginx: [emerg] open() "/usr/local/etc/nginx/syslog:server=unix:/var/run/syslogd.sockets" failed (2: No such file or directory)
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed
```


----------



## fred974 (Nov 11, 2014)

Can I ask why you want to send the log to syslogd()? How are you planning on monitoring what's going on on the web server? Especially if you have multiple domains.


----------



## uzsolt (Nov 11, 2014)

I want _to_ centralize the handling of logfiles. And maybe I want _to_ pipe nginx's logs. I have only one domain and I don't plan to improve this. I'm not _a_ system administrator, this is only my private VPS (works as a web server).


----------



## SirDice (Nov 11, 2014)

Ermm. What version of nginx do you have?



> 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.


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


----------



## uzsolt (Nov 11, 2014)

Ooops, my version is 1.6.2. So it seems now isn't available. Thanks.


----------



## Oko (Nov 22, 2014)

sammy1 said:


> Try upgrading ngnix to latest version and then try, it should work.


He is already using version 1.6.2. That is the latest version. You are advising him to switch to developmental branch 1.7 (currently at 1.7.7) That is a bad advice  1.7 is a moving target and releases happen every month, often breaking things.


----------



## uzsolt (Nov 22, 2014)

Yes, I don't want to switch to the development branch. I'll wait for the stable release which supports syslog.


----------

