[PATCH 3 of 5] Syslog: logging level of connect() errors

Maxim Dounin mdounin at mdounin.ru
Fri Mar 1 03:18:19 UTC 2024


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1709260935 -10800
#      Fri Mar 01 05:42:15 2024 +0300
# Node ID c769217b4a5ce653bc4c895e159105e375bf583f
# Parent  1c9264603adc240b226e1a149c01491d62302ded
Syslog: logging level of connect() errors.

Connecting to syslog server might legitimately fail: for example, if
syslogd is not running, and the connection is made over a unix socket.
As such, the "alert" logging level is not appropriate.  Changed
logging level to "crit" instead, similarly to the logging level used
for connect() errors in resolver.

diff --git a/src/core/ngx_syslog.c b/src/core/ngx_syslog.c
--- a/src/core/ngx_syslog.c
+++ b/src/core/ngx_syslog.c
@@ -364,7 +364,7 @@ ngx_syslog_init_peer(ngx_syslog_peer_t *
     }
 
     if (connect(fd, peer->server.sockaddr, peer->server.socklen) == -1) {
-        ngx_log_error(NGX_LOG_ALERT, &peer->log, ngx_socket_errno,
+        ngx_log_error(NGX_LOG_CRIT, &peer->log, ngx_socket_errno,
                       "connect() failed");
         goto failed;
     }




More information about the nginx-devel mailing list