Opened 5 years ago

Closed 5 years ago

#699 closed defect (invalid)

nginx logs to /var/log/nginx/error.log if syslog server is not available

Reported by: www.google.com/accounts/o8/id?id=AItOawmJuQtwZqC5pBHynSrOz9YU3lCve3_Slyo Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.7.x
Keywords: syslog Cc:
uname -a: Linux ip-172-31-12-120 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx -V nginx version: nginx/1.7.9 built by gcc 4.8.2 (Ubuntu 4.8.2-19ubuntu1) TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed' --with-ipv6

Description

I just switched to nginx's syslog and it works as desired. However there is some behaviour I think of as a bug:

This is the nginx.conf, I use:

    http {
      [...]
      access_log off;
      error_log off;
      # error_log /dev/null; # produces the same behaviour
      [...]

      server {
        [...]
        access_log syslog:server=127.0.0.1:5140;
        error_log syslog:server=127.0.0.1:5140;
        [...]
      }
    }

I have a syslog server (logstash with syslog input) on localhost, Port 5140 UDP.

This setup works.

However, when the syslog service is not availabe, nginx logs to

/var/log/nginx/error.log
This Path cannot be changed or removed.

The error.log contains messages like this on every request:

2015/01/19 15:10:45 [error] 2678#0: send() failed (111: Connection refused)

Imho when logging to UDP(syslog) the credo is "fire and forget", so nginx should not check at all if there's a syslog server available or not.

Change History (1)

comment:1 Changed 5 years ago by vl

  • Resolution set to invalid
  • Status changed from new to closed

first, there is no 'off' parameter in error_log. It just writes to file named 'off'.
second, example error messages provide important information for administrator in case if
logging is not functioning as intended (due to any reason).

note also that there is an 'error_log' directive in the main configuration context and it can be configured as well as http's one.

Note: See TracTickets for help on using tickets.