Hello Mariachiara Cesario,
welcome to this moderated Azure community forum.
It's hard to say there is one standard. This is related to the kind of device, the amount of logging, kind of connectivity, using the SDK or Azure IoT Edge.
What I have seen in the past is:
- Making use of the file upload. Perfect if you use the SDK
- Making use of sending logging as telemetry. good for incidental logging. You need to fork the telemetry stream from regular telemetry. Keep it small because it eats up a number of IoT Hub messages per day. You could write custom code to turn this on or off via a desired property wil the logging level
- Using a Direct Method to get a certain amount of logs is seen also. Azure IoT Edge offers this standard via the edgeAgent module
- Custom logging to a Storage account. You need to exchanging eg. a SAS token to keep the connection secret. Using Azure IoT Edge, Microsoft provides a specific Blob Storage Account module having a data pump towards the cloud.
- Other Custom logging towards the cloud via eg. an Azure Function or an Event Hub. Again, check out a secure solution for exchanging secrets to keep the connection secure
The file upload is actually used most. It's flexible and the security is handled by the IoT Hub, no extra logic is needed. With the addition to configure eg. the interval or level using desired properties.
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.