comparison src/core/ngx_syslog.h @ 9056:29adacffdefa

Syslog: removed usage of ngx_cycle->log and ngx_cycle->hostname. During initial startup the ngx_cycle->hostname is not available, and previously this resulted in incorrect logging. Instead, hostname from the configuration being parsed is now preserved in the syslog peer structure and then used during logging. Similarly, ngx_cycle->log might not match the configuration where the syslog peer is defined if the configuration is not yet fully applied, and previously this resulted in unexpected logging of syslog errors and debug information. Instead, cf->cycle->new_log is now referenced in the syslog peer structure and used for logging, similarly to how it is done in other modules.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 10 Mar 2023 07:43:40 +0300
parents 7f9935f07fe9
children 8771d35d55d0
comparison
equal deleted inserted replaced
9055:9db24374123b 9056:29adacffdefa
7 #ifndef _NGX_SYSLOG_H_INCLUDED_ 7 #ifndef _NGX_SYSLOG_H_INCLUDED_
8 #define _NGX_SYSLOG_H_INCLUDED_ 8 #define _NGX_SYSLOG_H_INCLUDED_
9 9
10 10
11 typedef struct { 11 typedef struct {
12 ngx_uint_t facility; 12 ngx_uint_t facility;
13 ngx_uint_t severity; 13 ngx_uint_t severity;
14 ngx_str_t tag; 14 ngx_str_t tag;
15 15
16 ngx_addr_t server; 16 ngx_str_t *hostname;
17 ngx_connection_t conn; 17
18 unsigned busy:1; 18 ngx_addr_t server;
19 unsigned nohostname:1; 19 ngx_connection_t conn;
20
21 ngx_log_t *log;
22
23 unsigned busy:1;
24 unsigned nohostname:1;
20 } ngx_syslog_peer_t; 25 } ngx_syslog_peer_t;
21 26
22 27
23 char *ngx_syslog_process_conf(ngx_conf_t *cf, ngx_syslog_peer_t *peer); 28 char *ngx_syslog_process_conf(ngx_conf_t *cf, ngx_syslog_peer_t *peer);
24 u_char *ngx_syslog_add_header(ngx_syslog_peer_t *peer, u_char *buf); 29 u_char *ngx_syslog_add_header(ngx_syslog_peer_t *peer, u_char *buf);