Updated on 2024-12-02 GMT+08:00

Device Reporting Log Content

Topic

Upstream: $oc/devices/{device_id}/sys/events/up

Function

This API is used by a device to report log content to the platform when log collection is enabled. The maximum size of the content is 1 MB.

Parameters

Parameter

Mandatory/Optional

Type

Description

services

Optional

List<ServiceEvent>

Explanation:

List of services that an event is about.

ServiceEvent structure

Parameter

Mandatory/Optional

Type

Description

service_id

Mandatory

String

Explanation:

System field.

Value range:

Fixed at $log.

event_type

Mandatory

String

Explanation:

System field.

Value range:

Fixed at log_report.

event_time

Optional

String

Explanation:

Event time. UTC time format: yyyyMMdd'T'HHmmss'Z'.

If this parameter is not carried in the reported data or is in incorrect format, the time when the platform receives the data is used.

paras

Mandatory

Object

Explanation:

Indicates the list of service events, which are defined in the product model associated with the device.

paras structure

Parameter

Mandatory/Optional

Type

Description

timestamp

Optional

String

Explanation:

Time when a log is generated.

type

Mandatory

String

Explanation:

Log type.

Value range:

DEVICE_STATUS: device status.

DEVICE_PROPERTY: device property.

DEVICE_MESSAGE: device message.

DEVICE_COMMAND: device command.

content

Mandatory

String

Explanation:

Indicates the log content.

Example

Topic: $oc/devices/{device_id}/sys/events/up   
Data format:
{ 
    "services": [{ 
        "service_id": "$log", 
        "event_type": "log_report", 
        "event_time": "20151212T121212Z",
        "paras": { 
            "timestamp": "1235668997",
            "type": "DEVICE_MESSAGE",
            "content": "log content"
        } 
    }] 
}