Hi,
I got feedback that on a TCP log server the TCP connections from
the clients are spamming the log file. The log clients reconnect
at every SIGHUP.
The easy fix is to write these accept and close messages with debug
priority, then they can be turned on in syslog.conf. Default is
off.
An alternative would be to keep the connections open at SIGHUP.
But that is inconistent to other log drains and would only work for
OpenBSD syslog clients.
While there move a debug message and set the priority of the exit
message explicitly to error.
ok?
bluhm
Index: usr.sbin/syslogd/syslogd.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.240
diff -u -p -r1.240 syslogd.c
--- usr.sbin/syslogd/syslogd.c 5 Apr 2017 22:15:35 -0000 1.240
+++ usr.sbin/syslogd/syslogd.c 7 Apr 2017 12:25:46 -0000
@@ -1134,7 +1134,7 @@ acceptcb(int lfd, short event, void *arg
p->p_peername = peername;
bufferevent_enable(p->p_bufev, EV_READ);
- log_info(LOG_INFO, "%s logger \"%s\" accepted",
+ log_info(LOG_DEBUG, "%s logger \"%s\" accepted",
p->p_ctx ? "tls" : "tcp", peername);
}
@@ -1261,7 +1261,7 @@ tcp_closecb(struct bufferevent *bufev, s
struct peer *p = arg;
if (event & EVBUFFER_EOF) {
- log_info(LOG_INFO, "%s logger \"%s\" connection close",
+ log_info(LOG_DEBUG, "%s logger \"%s\" connection close",
p->p_ctx ? "tls" : "tcp", p->p_peername);
} else {
log_info(LOG_NOTICE, "%s logger \"%s\" connection error: %s",
@@ -2146,15 +2146,14 @@ void
init_signalcb(int signum, short event, void *arg)
{
init();
-
log_info(LOG_INFO, "restart");
- log_debug("syslogd: restarted");
if (tcpbuf_dropped > 0) {
log_info(LOG_WARNING, "dropped %d message%s to remote loghost",
tcpbuf_dropped, tcpbuf_dropped == 1 ? "" : "s");
tcpbuf_dropped = 0;
}
+ log_debug("syslogd: restarted");
}
void
@@ -2189,7 +2188,7 @@ die(int signo)
}
if (signo)
- log_warnx("exiting on signal %d", signo);
+ log_info(LOG_ERR, "exiting on signal %d", signo);
log_debug("syslogd: exited");
exit(0);
}