You are operating an IoT solution of a large number of field devices.
After several weeks of operation, you notice that a certain group of temperature sensors cease sending telemetry in the morning hours.
You suspect that some kind of connection problems block messages and you decide to create a diagnostic setting in your IoT Hub, route the resource logs to Azure Monitor Logs and to analyze the log by running the following query:
AzureDiagnostics | where ( ResourceType == "IOTHUBS" and Category == "DeviceTelemetry" and Level == "Error")Does it help you to localize the errors?
Click on the arrows to vote for the correct answer
A. B.Correct Answer: B.
Option A is incorrect because while sending logs to Azure Monitor Log is a right decision, the “DeviceTelemetry” category is used to track errors related to messages sent by the devices that are connected to the IoT hub.
Therefore, “DeviceTelemetry” is not the right choice.
Option B is CORRECT because in order to find connection related error events in the log, the “Connections” diagnostic setting has to be configured (see below), and Category == “Connections” has to be used to filter the log entries.
Diagram:
Reference:
Yes, running the query on the Azure Monitor Logs using the diagnostic setting for the IoT Hub will help to localize the errors related to the temperature sensors that stop sending telemetry in the morning hours.
The query filters the log data based on the resource type, category, and level. It specifies the AzureDiagnostics table and filters for the ResourceType of "IOTHUBS," the Category of "DeviceTelemetry," and the Level of "Error." These filters will return only the log entries that pertain to device telemetry in the IoT Hub and are classified as errors. By analyzing the logs returned by the query, it will be possible to identify the errors that are causing the temperature sensors to stop sending telemetry during the morning hours.
Using Azure Monitor Logs and diagnostic settings to collect and analyze logs is a best practice in IoT solutions, as it provides valuable insights into the behavior of the devices and the health of the overall system. It can help to identify and troubleshoot problems, optimize performance, and monitor system behavior over time.