diff src/stream/ngx_stream_log_module.c @ 9224:c7c8354f99fa

Syslog: fixed duplicate errors with access logging to syslog. The ngx_syslog_send() function logs errors itself, so there is no need to additionally log errors in the caller, notably access log modules in http and stream. To ensure that incomplete and blocked writes are also logged, appropriate logging added to ngx_syslog_send().
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 01 Mar 2024 05:42:09 +0300
parents 1ab290cf5267
children
line wrap: on
line diff
--- a/src/stream/ngx_stream_log_module.c
+++ b/src/stream/ngx_stream_log_module.c
@@ -201,8 +201,7 @@ static ngx_int_t
 ngx_stream_log_handler(ngx_stream_session_t *s)
 {
     u_char                     *line, *p;
-    size_t                      len, size;
-    ssize_t                     n;
+    size_t                      len;
     ngx_str_t                   val;
     ngx_uint_t                  i, l;
     ngx_stream_log_t           *log;
@@ -324,19 +323,7 @@ ngx_stream_log_handler(ngx_stream_sessio
 
         if (log[l].syslog_peer) {
 
-            size = p - line;
-
-            n = ngx_syslog_send(log[l].syslog_peer, line, size);
-
-            if (n < 0) {
-                ngx_log_error(NGX_LOG_WARN, s->connection->log, 0,
-                              "send() to syslog failed");
-
-            } else if ((size_t) n != size) {
-                ngx_log_error(NGX_LOG_WARN, s->connection->log, 0,
-                              "send() to syslog has written only %z of %uz",
-                              n, size);
-            }
+            (void) ngx_syslog_send(log[l].syslog_peer, line, p - line);
 
             continue;
         }