summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Giacobbi <giovanni@giacobbi.net>2021-07-27 15:15:26 +0200
committerDaniel Golle <daniel@makrotopia.org>2021-08-03 22:02:36 +0100
commit205defb597295a4a8966db3e618cfe41a29bed99 (patch)
treecb69e7442b552b29b14f409417608f0e5d44b911
parent1f4f72bde55e8c5810db4ead4170352febd2dbfb (diff)
downloadubox-205defb597295a4a8966db3e618cfe41a29bed99.tar.gz
logread: fix erroneous message "Logread connected to" with udp
When streaming the syslog messages via udp, the socket connection always succeeds by definition, but it can still fail to send. In such case, the syslog keep repeating the following two messages: failed to send log data to ip:port via udp Logread connected to ip:port With this change, only one initial message "Logread connected to..." is logged. Also fixed capital letter for "failed to send" message. Signed-off-by: Giovanni Giacobbi <giovanni@giacobbi.net> Signed-off-by: Daniel Golle <daniel@makrotopia.org> (string de-duplication)
-rw-r--r--log/logread.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/log/logread.c b/log/logread.c
index a764742..f48dd4b 100644
--- a/log/logread.c
+++ b/log/logread.c
@@ -97,7 +97,13 @@ static void log_handle_reconnect(struct uloop_timeout *timeout)
uloop_timeout_set(&retry, 1000);
} else {
uloop_fd_add(&sender, ULOOP_READ);
- syslog(LOG_INFO, "Logread connected to %s:%s\n", log_ip, log_port);
+
+ if (log_udp < 2)
+ syslog(LOG_INFO, "Logread connected to %s:%s via %s\n",
+ log_ip, log_port, (log_udp) ? ("udp") : ("tcp"));
+
+ if (log_udp == 1)
+ ++log_udp;
}
}
@@ -192,7 +198,7 @@ static int log_notify(struct blob_attr *msg)
}
if (err < 0) {
- syslog(LOG_INFO, "failed to send log data to %s:%s via %s\n",
+ syslog(LOG_INFO, "Failed to send log data to %s:%s via %s\n",
log_ip, log_port, (log_udp) ? ("udp") : ("tcp"));
uloop_fd_delete(&sender);
close(sender.fd);