Opened 5 years ago

Closed 5 years ago

#771 closed defect (invalid)

`unix:/dev/log` doesn't work for `server` argument to `(access|error)_log`

Reported by: Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.9.x
Keywords: syslog AF_UNIX docker Cc:
uname -a: Linux 72fdf13f1404 3.18.11-tinycore64 #1 SMP Sun Apr 19 08:39:18 UTC 2015 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.9.1
built with OpenSSL 1.0.1k 8 Jan 2015 (running with OpenSSL 1.0.2c 12 Jun 2015)
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/ --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --add-module=/tmp/buildd/nginx-1.9.1/debian/modules/nginx-auth-pam --add-module=/tmp/buildd/nginx-1.9.1/debian/modules/nginx-dav-ext-module --add-module=/tmp/buildd/nginx-1.9.1/debian/modules/nginx-echo --add-module=/tmp/buildd/nginx-1.9.1/debian/modules/nginx-upstream-fair --add-module=/tmp/buildd/nginx-1.9.1/debian/modules/ngx_http_substitutions_filter_module


I am running syslog-ng inside a Docker container (based from debian:wheezy) with the following configuration:

@version: 3.5

options {

source s_local {

source s_loopback {
    udp ();

destination d_local {
        template("${YEAR}-${MONTH}-${DAY}T${HOUR}:${MIN}:${SEC}${TZ} ${HOST} [${LEVEL}] ${PROGRAM} ${MSG}\n")

log {

log {

I have the following in my nginx configuration:

daemon off;

http {
    server {
        access_log syslog:server=unix:/dev/log;
        error_log stderr warn;

Inside the container, I start syslog-ng which creates /dev/log:

# ls -al /dev/log
srw-rw-rw- 1 root root 0 Jun 27 16:08 /dev/log

Then (also inside the container) I start nginx. When I hit nginx (with curl), I don't get any access log messages in /var/log/.../messages and get errors like the following on stderr:

... *25 send() to syslog failed while logging request, client:, server: , request: "GET / HTTP/1.1", ...

Note the blank value for server:. If I change the nginx configuration to the following, everything works as expected (I get access and error messages in /var/log/.../messages, and the previous send() error log warnings go away):

daemon off;

http {
    server {
        access_log syslog:server=localhost;
        error_log syslog:server=localhost warn;

All my nginx packages are from Debian's wheezy branch:

# dpkg -l nginx\*
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                               Version                Architecture           Description
un  nginx                              <none>                 <none>                 (no description available)
ii  nginx-common                       1.9.1-1                all                    small, powerful, scalable web/proxy server - common files
un  nginx-doc                          <none>                 <none>                 (no description available)
un  nginx-extras                       <none>                 <none>                 (no description available)
ii  nginx-full                         1.9.1-1                amd64                  nginx web/proxy server (standard version)
un  nginx-light                        <none>                 <none>                 (no description available)

Change History (1)

comment:1 by vl, 5 years ago

Resolution: invalid
Status: newclosed

nginx uses datagrams when writing messages to log;
you have configured unix-stream("/dev/log"), what
is wrong. Use "unix-dgram" source to receive

Note: See TracTickets for help on using tickets.