- Fix that dnstap reconnects do not spam the log with the repeated

attempts.  Attempts on the timer are only logged on high verbosity,
  if they produce a connection failure error.
This commit is contained in:
W.C.A. Wijngaards 2020-08-24 09:23:36 +02:00
parent e6ebabc0cc
commit 45712de9a2
2 changed files with 15 additions and 0 deletions

View file

@ -1873,6 +1873,11 @@ static int dtio_open_output_local(struct dt_io_thread* dtio)
if(connect(dtio->fd, (struct sockaddr*)&s, (socklen_t)sizeof(s)) if(connect(dtio->fd, (struct sockaddr*)&s, (socklen_t)sizeof(s))
== -1) { == -1) {
char* to = dtio->socket_path; char* to = dtio->socket_path;
if(dtio->reconnect_timeout > DTIO_RECONNECT_TIMEOUT_MIN &&
verbosity < 4) {
dtio_close_fd(dtio);
return 0; /* no log retries on low verbosity */
}
#ifndef USE_WINSOCK #ifndef USE_WINSOCK
log_err("dnstap io: failed to connect to \"%s\": %s", log_err("dnstap io: failed to connect to \"%s\": %s",
to, strerror(errno)); to, strerror(errno));
@ -1916,6 +1921,11 @@ static int dtio_open_output_tcp(struct dt_io_thread* dtio)
if(connect(dtio->fd, (struct sockaddr*)&addr, addrlen) == -1) { if(connect(dtio->fd, (struct sockaddr*)&addr, addrlen) == -1) {
if(errno == EINPROGRESS) if(errno == EINPROGRESS)
return 1; /* wait until connect done*/ return 1; /* wait until connect done*/
if(dtio->reconnect_timeout > DTIO_RECONNECT_TIMEOUT_MIN &&
verbosity < 4) {
dtio_close_fd(dtio);
return 0; /* no log retries on low verbosity */
}
#ifndef USE_WINSOCK #ifndef USE_WINSOCK
if(tcp_connect_errno_needs_log( if(tcp_connect_errno_needs_log(
(struct sockaddr *)&addr, addrlen)) { (struct sockaddr *)&addr, addrlen)) {

View file

@ -1,3 +1,8 @@
24 August 2020: Wouter
- Fix that dnstap reconnects do not spam the log with the repeated
attempts. Attempts on the timer are only logged on high verbosity,
if they produce a connection failure error.
20 August 2020: Ralph 20 August 2020: Ralph
- Fix stats double count issue (#289). - Fix stats double count issue (#289).