2

I need to make device's uptime statistics. I want to get information about connections/disconnections from logs, but I don't know what is the best way to log these event from IoT hub.

I've already tried:

  • Event grid. Not very good because: "order of events is not guaranteed" according to the documentation.
  • Diagnostics in IoT hub: "The events emitted by the IoT Hub service using Azure Monitor diagnostic logs are not guaranteed to be reliable or ordered. Some events might be lost or delivered out of order."
  • Device heartbeat: from documentation: "Only use the connectionState field during development and debugging".
  • Function application or Logic app: how to trigger by connecting/disconnecting?

What else can I try?

Openzz
  • 65
  • 5
  • 1
    For Event grid: using an event properties such as the eventTime and sequenceNumber can be useful for helping to indicate an order of the device connected or device disconnected events. See an example: https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-how-to-order-connection-state-events – Roman Kiss Sep 20 '18 at 16:14
  • Agree with Roman Kiss. Actually I'm not aware of another (not listed by you) approach to monitor these events. As long as you need them for "uptime statistics", then you shouldn't bother about order of delivery or delay. I think the best way is to use Event Grid – Vladislav Oct 02 '18 at 11:20
  • So it is not possible to monitor the _Microsoft.Devices.DeviceConnected_ events via the internal IoT Event Hub endpoint? – binaryguy Nov 25 '18 at 11:43
  • Did you check the following: https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-identity-registry#device-heartbeat ? – asergaz Dec 07 '18 at 18:21

0 Answers0