4

Context: I am sending temp/humidity data from an NCD.io sensor through a gateway device to Azure, where it is being stored in the IoT Hub, somewhere.

enter image description here

Problem: Where is this data? I can access it through the device twin & also see it being sent via the Azure CLI, but the data logged in the IoT Hub only conveys information about the gateway message itself, not the actual data. The screenshot is a chart of messages received to date; I can go step deeper and glean insights about the messages but nothing about the sensor data.

enter image description here

Can this information only be accessed via another service? Is there no way to view data in the Hub?

Looking for clarification, tips/tricks. Thanks!!

4
  • I am no expert with Azure IoT Hub. I'll be interested in what others say. From my understanding, the hub is a router. Yes, it can store the events for a period of time as part of the routing. But I thought to actually get it in a store you can use, you'd have to use the event grid and do some action there to write it into something you have access to. Lets see what the Azure IoT experts say. Commented Mar 27, 2021 at 6:35
  • 1
    @kalyanswaroop a router knows nothing about data ... it does not store it ... it stores the address of the next router along the path to the destination ... the IoT hub is a server
    – jsotola
    Commented Mar 27, 2021 at 16:45
  • @jsotola, in this instance, I was commenting about the Azure IoT hub. Its function is to route (the way I understand it), but it does have a retention period which can be upto 7 days. That's the storage I was talking about. See docs.microsoft.com/en-us/azure/iot-hub/… for more info on this storage capability. Commented Mar 31, 2021 at 19:47
  • I was wondering if you found a solution to this and if you could share how to store and see the data being logged in Azure.
    – PEJ
    Commented Jan 22 at 3:06

2 Answers 2

1

Azure IoT Hub doesn't act as Telemetry database for querying the data. Indeed it's storing the data for the specified time defined in the retention policy but you don't have a direct access to it from the portal. To get the data you can do the following -

  1. Create a Message Route on the Device Telemetry Messages that will route your messages to an external storage. https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-d2c
  2. Create an Azure Function with IoT Hub trigger that will get the messages and then you can programmatically route them. https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-iot-trigger?tabs=csharp
  3. Use tools like Device Explorer - https://docs.microsoft.com/en-us/azure/iot-pnp/howto-use-iot-explorer
  4. Use the EventProcessorHost library to get the data https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-event-processor-host
0

Here are a couple of articles that may explain it for you.

https://docs.microsoft.com/en-us/previous-versions/azure/iot-accelerators/iot-accelerators-remote-monitoring-sample-walkthrough

https://azure.microsoft.com/en-us/blog/route-iot-device-messages-to-azure-storage-with-azure-iot-hub/

From the first link. Basically seems to me that by default the data is kept in CosmoDB. That makes sense to me as it would be the perfect place as I believe I read CosmoDB guarantees single digit latency and it is massive and designed for such things.

Apparently, there is some abstraction that lets you access it through the Storage Adaptor Micro Service. So I think that is why you can assess it through the Device Twin.

The second link speaks about being able to save the data to custom endpoints like blob storage. I suppose if you want access to the data to download it is possible.

I am not an expert but interested. Hope this helps. If someone gets a different interpretation of the Microsoft links I am interested.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.