[nginx] Syslog: logging level of connect() errors.

Maxim Dounin mdounin at mdounin.ru
Wed Mar 13 15:52:32 UTC 2024


details:   http://freenginx.org/hg/nginx/rev/c769217b4a5c
branches:  
changeset: 9226:c769217b4a5c
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Fri Mar 01 05:42:15 2024 +0300
description:
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.

diffstat:

 src/core/ngx_syslog.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

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