From 52ee8d10044e40c6d0c9c8b84a933a9d73b3abcd Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Thu, 12 Jun 2025 09:33:02 +0200 Subject: [PATCH] Reduce logging of websocket messages This updates the websocket authenticator to only produce verbose messages, as the connections are expected to fail for various reasons. --- .../WebserverCore/Notifications/WebsocketAuthenticator.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Duplicati/WebserverCore/Notifications/WebsocketAuthenticator.cs b/Duplicati/WebserverCore/Notifications/WebsocketAuthenticator.cs index 032ddb782..be6325fbe 100644 --- a/Duplicati/WebserverCore/Notifications/WebsocketAuthenticator.cs +++ b/Duplicati/WebserverCore/Notifications/WebsocketAuthenticator.cs @@ -88,7 +88,7 @@ public class WebsocketAuthenticator( if (connection.Value + MaxAuthTime < DateTime.UtcNow) { - Log.WriteInformationMessage(LOGTAG, "WebsocketConnectionTimeout", $"WebSocket connection timed out after {MaxAuthTime.TotalSeconds} seconds."); + Log.WriteVerboseMessage(LOGTAG, "WebsocketConnectionTimeout", $"WebSocket connection timed out after {MaxAuthTime.TotalSeconds} seconds."); await connection.Key.CloseAsync((WebSocketCloseStatus)4401, "User is not authenticated!", CancellationToken.None); _connections.TryRemove(connection.Key, out _); continue; @@ -123,7 +123,7 @@ public class WebsocketAuthenticator( } catch (Exception ex) { - Log.WriteErrorMessage(LOGTAG, "WebsocketDeserializationError", ex, $"Failed to deserialize websocket message: {ex.Message}"); + Log.WriteVerboseMessage(LOGTAG, "WebsocketDeserializationError", ex, $"Failed to deserialize websocket message: {ex.Message}"); } if (message == null) @@ -153,12 +153,12 @@ public class WebsocketAuthenticator( if (!isValid) { - Log.WriteWarningMessage(LOGTAG, "WebsocketInvalidToken", exception, $"WebSocket connection with invalid token: {message.Token}"); + Log.WriteVerboseMessage(LOGTAG, "WebsocketInvalidToken", exception, $"WebSocket connection with invalid token"); await SendRequestReply(socket, "Invalid token", false); return; } - Log.WriteInformationMessage(LOGTAG, "WebsocketAuthenticated", $"WebSocket connection authenticated with token: {message.Token}"); + Log.WriteVerboseMessage(LOGTAG, "WebsocketAuthenticated", $"WebSocket connection authenticated with token"); await SendRequestReply(socket, "Authenticated successfully", true); await websocketAccessor.AddConnection(socket, false);