actually use the specified log style

This commit is contained in:
Omar Polo 2023-08-03 22:37:34 +00:00
parent 56054fe197
commit 26df50981f
4 changed files with 16 additions and 1 deletions

View File

@ -65,10 +65,11 @@ config_purge(struct conf *conf)
struct alist *a, *ta;
struct pki *pki, *tpki;
struct address *addr, *taddr;
int use_privsep_crypto;
int use_privsep_crypto, log_format;
ps = conf->ps;
use_privsep_crypto = conf->use_privsep_crypto;
log_format = conf->log_format;
free(conf->log_access);
free_mime(&conf->mime);
@ -150,6 +151,7 @@ config_purge(struct conf *conf)
conf->use_privsep_crypto = use_privsep_crypto;
conf->protos = TLS_PROTOCOL_TLSv1_2 | TLS_PROTOCOL_TLSv1_3;
conf->log_syslog = 1;
conf->log_format = log_format;
init_mime(&conf->mime);
TAILQ_INIT(&conf->fcgi);
TAILQ_INIT(&conf->hosts);
@ -289,6 +291,10 @@ config_send(struct conf *conf)
struct alist *a;
size_t i;
if (proc_compose(ps, PROC_SERVER, IMSG_RECONF_LOG_FMT,
&conf->log_format, sizeof(conf->log_format)) == -1)
return -1;
for (i = 0; i < conf->mime.len; ++i) {
m = &conf->mime.t[i];
if (proc_compose(ps, PROC_SERVER, IMSG_RECONF_MIME,
@ -528,6 +534,11 @@ config_recv(struct conf *conf, struct imsg *imsg)
p = NULL;
break;
case IMSG_RECONF_LOG_FMT:
IMSG_SIZE_CHECK(imsg, &conf->log_format);
memcpy(&conf->log_format, imsg->data, datalen);
break;
case IMSG_RECONF_MIME:
IMSG_SIZE_CHECK(imsg, &m);
memcpy(&m, imsg->data, datalen);

2
gmid.c
View File

@ -126,6 +126,8 @@ log_request(struct client *c, int code, const char *meta)
strlcpy(b, t, sizeof(b));
}
log_warnx("log format is %d", conf->log_format);
switch (conf->log_format) {
case LOG_FORMAT_LEGACY:
ec = asprintf(&fmted, "%s:%s GET %s %d %s", c->rhost,

1
gmid.h
View File

@ -334,6 +334,7 @@ enum imsg_type {
IMSG_LOG_SYSLOG,
IMSG_RECONF_START,
IMSG_RECONF_LOG_FMT,
IMSG_RECONF_MIME,
IMSG_RECONF_PROTOS,
IMSG_RECONF_SOCK,

View File

@ -1501,6 +1501,7 @@ server_dispatch_parent(int fd, struct privsep_proc *p, struct imsg *imsg)
switch (imsg->hdr.type) {
case IMSG_RECONF_START:
case IMSG_RECONF_LOG_FMT:
case IMSG_RECONF_MIME:
case IMSG_RECONF_PROTOS:
case IMSG_RECONF_SOCK: