How to get log of IOT Edge devices modules status using Kusto query

Khandu Shinde 110 Reputation points
2024-01-09T12:54:57.57+00:00

Hello All

I have Azure IoT Edge which contains few modules. I have attached screenshot as below for reference. Now, one of the module got runtime status as error. How to identify such modules whose status is showing error (not running) using Kusto query? I am seeing logs into AzureDiagnostics.

I have to set monitoring alerts using Terraform. Thank you in advance.

Untitled10

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
535 questions
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,116 questions
0 comments No comments
{count} votes

Accepted answer
  1. LeelaRajeshSayana-MSFT 13,456 Reputation points
    2024-01-10T02:29:51.9833333+00:00

    Hi @Khandu Shinde Thank you for posting the question here. As Sander pointed, this is a weird issue. It could most likely be caused by failed module deployment. Please try the steps suggested by Sander to figure out which module is causing this behavior.

    How to identify such modules whose status is showing error (not running) using Kusto query?

    To briefly answer your question, I don't think it is possible to monitor the IoT Edge modules runtime status through logs using Kusto Query. Even though you enable Connections category under Azure Diagnostics they will only be able to capture the high level connection status of the IoT Edge device. Meaning if the edgeAgent module and edgeHub module stay connected, the device connection status shows as connected in the log level. You would not be able to get more granulated information on your custom modules from the Azure Diagnostics.

    To get this information, you can query the IoT device edgeAgent module twin and look for the custom modules runtimeStatus property under the reported properties section. This gives you the information on the runtime status of your custom module. Please refer the article Monitor Module Twins for more information on what details can be captured from the module twins and different approaches through which they can be monitored.

    Alternatively, you can deploy IoT Edge Metrics Collector module to your IoT Edge devices that lets you remotely monitor how an IoT Edge device or its individual modules are performing. Enabling this module on the devices lets you to monitor the modules through Workbooks from the Azure portal. Please refer the below image for reference

    User's image

    Please refer the article Monitor IoT Edge devices for more information on how to set up and use these metrics.

    Hope this helps! Please let us know if you have any additional questions or need further assistance.


    If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.


1 additional answer

Sort by: Most helpful
  1. Sander van de Velde 28,386 Reputation points MVP
    2024-01-09T19:04:27.4466667+00:00

    Hello @Khandu Shinde ,

    Do not share personal information on this public forum.

    This is an interesting view, a module without a name...

    It feels like just a misconfiguration of the deployment manifest for this edge device.

    Something like this is usually first checked in the Azure portal

    Please check the following:

    • Using the "Set Modules" dialog, you can get more information regarding the registration of this module, like the container identification. This is in fact the deployment manifest you are editing so only change something if you know what you are doing :-)
    • On your edge device run "[sudo] iotedge list" (sudo, for elevated rights if needed) to get a list of deployed modules. Do you see a module that is not running? Can you relate it to the one above?
    • You can also run troubleshooting for the 'edgeAgent' module. This logging should show attempts to restart of some module.

    I'm not sure how this is related to the Terraform usage. Or do you use Terraform to register edge devices too?


    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.