Hello @85141552,
welcome to this moderated Azure community forum.
The most reliable way to monitor devices connecting and disconnecting is to make use of the EventGrid events or via IoT Hub routes (routing device lifecycle events).
Please compare these two ways to log events for the best response.
More background information regarding implementing reconnected in the client is documented here.
As an alternative, if you program the device connectivity yourself, you could write custom code to detect disconnections on the client:
deviceClient.SetConnectionStatusChangesHandler(ConnectionStatusChangeHandler);
private static void ConnectionStatusChangeHandler(ConnectionStatus status, ConnectionStatusChangeReason reason)
{
Console.WriteLine($"Connection Status Changed to {status} ({reason}) at {DateTime.Now}");
}
This way, you can measure the connectivity both in the cloud and on devices.
If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.