OPC UA SDK logging is discarded (no-op telemetry): server-side identity/certificate rejections leave no log line #874

Closed
opened 2026-11-11 16:34:48 -05:00 by dohertj2 · 1 comment
Owner

Found by the #800 partial Windows validation on windev: the server rejected API-key logins with BadIdentityTokenInvalid (see the clock-skew issue) and logged nothing. The OPC UA application host gives the SDK a no-op telemetry logger (DefaultTelemetry.Create(_ => { }) in OpcUaApplicationHost.cs), so SDK-side rejections are invisible: identity-token decryption failures, certificate validation failures and secure-channel faults.

Fix: route SDK telemetry into the host's Serilog ILoggerFactory at Warning and above, with a category such as Opc.Ua. Without that, an operator cannot diagnose these refusals from the server side.

Found by the #800 partial Windows validation on windev: the server rejected API-key logins with `BadIdentityTokenInvalid` (see the clock-skew issue) and logged **nothing**. The OPC UA application host gives the SDK a no-op telemetry logger (`DefaultTelemetry.Create(_ => { })` in `OpcUaApplicationHost.cs`), so SDK-side rejections are invisible: identity-token decryption failures, certificate validation failures and secure-channel faults. **Fix:** route SDK telemetry into the host's Serilog `ILoggerFactory` at Warning and above, with a category such as `Opc.Ua`. Without that, an operator cannot diagnose these refusals from the server side.
dohertj2 added the type:bugpriority:p2 labels 2026-11-11 16:34:48 -05:00
Author
Owner

Fixed, pushed to master in 43f8b8e8 (2e948d31). The hosted service now creates one ServerSdkTelemetry context from its ILoggerFactory, shared by OtOpcUaSdkServer and the ApplicationInstance and released on dispose. It forwards Warning and above under the SDK's own categories, rate-limited to 20 per minute per category, so a client retrying in a loop cannot flood the log. Test: Sdk2TrustedChannelTests.An_sdk_side_refusal_reaches_the_server_log (an untrusted client's rejection reaches the captured log). The full local suite is green.

Fixed, pushed to master in `43f8b8e8` (`2e948d31`). The hosted service now creates one `ServerSdkTelemetry` context from its `ILoggerFactory`, shared by `OtOpcUaSdkServer` and the `ApplicationInstance` and released on dispose. It forwards Warning and above under the SDK's own categories, rate-limited to 20 per minute per category, so a client retrying in a loop cannot flood the log. Test: `Sdk2TrustedChannelTests.An_sdk_side_refusal_reaches_the_server_log` (an untrusted client's rejection reaches the captured log). The full local suite is green.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dohertj2/lmxopcua#874