diff --git a/src/netlog/netlog-manager.c b/src/netlog/netlog-manager.c index 8d62458..8522cc2 100644 --- a/src/netlog/netlog-manager.c +++ b/src/netlog/netlog-manager.c @@ -379,7 +379,9 @@ static int manager_journal_monitor_listen(Manager *m) { if (r < 0) return r; - sd_journal_set_data_threshold(m->journal, 0); + r = sd_journal_set_data_threshold(m->journal, 0); + if (r < 0) + log_warning_errno(r, "Failed to set journal data field size threshold"); m->journal_watch_fd = sd_journal_get_fd(m->journal); if (m->journal_watch_fd < 0) diff --git a/src/netlog/netlog-network.c b/src/netlog/netlog-network.c index 5632f42..350c609 100644 --- a/src/netlog/netlog-network.c +++ b/src/netlog/netlog-network.c @@ -87,6 +87,7 @@ int manager_push_to_network(Manager *m, switch (m->protocol) { case SYSLOG_TRANSMISSION_PROTOCOL_DTLS: if (!m->dtls->connected) { + log_debug("DTLS not connected, performing reconnect"); r = manager_connect(m); if (r < 0) return r; @@ -95,6 +96,7 @@ int manager_push_to_network(Manager *m, break; case SYSLOG_TRANSMISSION_PROTOCOL_TLS: if (!m->tls->connected) { + log_debug("TLS not connected, performing reconnect"); r = manager_connect(m); if (r < 0) return r; @@ -102,6 +104,7 @@ int manager_push_to_network(Manager *m, break; default: if (!m->connected) { + log_debug("%s not connected, performing reconnect", protocol_to_string(m->protocol)); r = manager_connect(m); if (r < 0) return r; @@ -136,6 +139,7 @@ void manager_close_network_socket(Manager *m) { int manager_network_connect_socket(Manager *m) { _cleanup_free_ char *pretty = NULL; union sockaddr_union sa; + const char *protocol; socklen_t salen; int r; @@ -167,16 +171,18 @@ int manager_network_connect_socket(Manager *m) { if (r < 0) return r; - log_debug("Connecting to remote server: '%s'", pretty); + protocol = protocol_to_string(m->protocol); + + log_debug("Connecting to remote server: '%s/%s'", pretty, protocol); r = connect(m->socket, &m->address.sockaddr.sa, salen); if (r < 0 && errno != EINPROGRESS) - return log_error_errno(errno, "Failed to connect to remote server='%s': %m", pretty); + return log_error_errno(errno, "Failed to connect to remote server='%s/%s': %m", pretty, protocol); if (errno != EINPROGRESS) - log_debug("Connected to remote server: '%s'", pretty); + log_debug("Connected to remote server: '%s/%s'", pretty, protocol); else - log_debug("Connection in progress to remote server: '%s'", pretty); + log_debug("Connection in progress to remote server: '%s/%s'", pretty, protocol); return 0; } diff --git a/src/netlog/netlog-protocol.c b/src/netlog/netlog-protocol.c index 52814df..38d436f 100644 --- a/src/netlog/netlog-protocol.c +++ b/src/netlog/netlog-protocol.c @@ -23,6 +23,7 @@ int protocol_send(Manager *m, struct iovec *iovec, unsigned n_iovec) { case SYSLOG_TRANSMISSION_PROTOCOL_DTLS: r = dtls_datagram_writev(m->dtls, iovec, n_iovec); if (r < 0 && r != -EAGAIN) { + log_debug_errno(r, "Failed to send via DTLS, performing reconnect: %m"); manager_connect(m); return r; } @@ -30,6 +31,7 @@ int protocol_send(Manager *m, struct iovec *iovec, unsigned n_iovec) { case SYSLOG_TRANSMISSION_PROTOCOL_TLS: r = tls_stream_writev(m->tls, iovec, n_iovec); if (r < 0 && r != -EAGAIN) { + log_debug_errno(r, "Failed to send via TLS, performing reconnect: %m"); manager_connect(m); return r; } @@ -37,6 +39,7 @@ int protocol_send(Manager *m, struct iovec *iovec, unsigned n_iovec) { default: r = network_send(m, iovec, n_iovec); if (r < 0 && r != -EAGAIN) { + log_debug_errno(r, "Failed to send via %s, performing reconnect: %m", protocol_to_string(m->protocol)); manager_connect(m); return r; }