How to clear my iothub partitions?

Sharon Nisha Thiruvarul Durai 0 Reputation points
2024-01-31T07:11:35.74+00:00

Hi all, 30 devices of mine sent continuous data (every second) for 18 hours. The message quota went upto 182K messages in 1 day. I need to get rid of the old data(185K messages) so that i can only receive the latest data. I have turned all 30 devices off but data is still being sent by the iot hub (old data). Is there a way I can restart the iot hub from command line/ clear the partitions so that this behaviour stops? Thank you Best Regards, Sharon Nisha.

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,127 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde 29,196 Reputation points MVP
    2024-01-31T10:08:53.15+00:00

    Hello @Sharon Nisha Thiruvarul Durai ,

    welcome to this moderated Azure community forum.

    The IoT Hub ingests data from devices and queues them for other services.

    The retention time (the timespan other services can pick message before there are deleted) is 1 to 7 days. By default this is one day.

    The Iot Hub can not actively be purged. You need to consume all older messages before you get the latest ones.

    There are four ways to get around this:

    1. You could try to decrease the retention time if possible.
    2. If you use the default event-hub compatible endpoint, you could try to switch over to a new consumer group (see $default) for your consuming application (e.g. an Azure Function or Azure Stream Analytics).
    3. You could create a new route with a filter on the CORRECT messages and use that route
    4. You can make your consuming application more robust and have it filter out and ignore the wrong messages

    I hope this explains the way the IoT Hub passes on all messages.


    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.

    0 comments No comments