Best Practices for Collecting IoT Device Running Logs Remotely

1. Background
When IoT devices are distributed all over the world, in order to troubleshoot problems in a specific environment, we often have the need to obtain device-side operation logs. We send a crew member on a business trip to the equipment site, often at a high cost. At this time, with the power of IoT technology, it is the most ideal solution to easily obtain remote device logs by moving your fingers in the cloud.


2. Architecture scheme
image.png
The complete interactive process for the cloud to obtain device-side running logs:

The background business server calls the Pub interface, and sends instructions to the specified device to collect running logs

Topic is xxx/xxx/user/report/log
Payload contains STS Token for accessing OSS, bucket, target path key
The IoT platform publishes messages to specified devices
After the device receives the instruction, it uploads the operation log to the OSS target path
Device Publish reports log collection execution results

Topic is xxx/xxx/user/log/information
Payload contains file storage bucket, path key
The business server receives the data returned by the device
Obtain device operation log files from the business server to OSS

3. Development practice
In order to realize the above ideals, we need to invest in the research and development work on the server side and the device side in the early stage.

3.1 Server
Deploy the business logic on the server side to generate a temporary STS Token for accessing OSS
Write Pub logic for downstream instructions
Configure the rule engine to receive the business logic of the device response result
Business logic for accessing OSS resource files
3.2 Device side
The device outputs the running log to a local file
Subscribe to the topic of the log collection command
The logic of uploading local files to the specified OSS path
The logic of reporting log collection execution results

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00

phone Contact Us