Enable the IoT Hub Diagnostic settings

(1) Navigate to your Azure IoT Hub and select "Diagnostic settings" from the Monitoring menu:


(2) Select + Add diagnostic setting


(3) Select the Categories "Connections" and the Destination details "Send to Log Analytics workspace". Give your new diagnostic setting a name and select "Save"

Query the diagnostic logs

(1) Navigate to your Azure IoT Hub and select "Logs" from the Monitoring menu.

(2) Copy and paste the syntax below into the query window and select "Run"

// Connectivity errors
// Identify device connection errors
// To create an alert for this query, click '+ New alert rule'
AzureDiagnostics
| where ResourceProvider == "MICROSOFT.DEVICES" and ResourceType == "IOTHUBS"
| where Category == "Connections" and Level == "Error"



Interpreting the query results

IoT Hub Client collisions

Errors would be returned for the device/client that included the following properties:

  • OperationName = deviceDisconnect
  • Level = Error
  • ResultDescription = ConnectionForcefullyClosedOnNewConnection
  • Properties_s = <will give you the device id and the IP address>



  • No labels