Updated on 2023-02-16 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 or Optional

Type

Description

services

Optional

List<ServiceEvent>

Indicates a list of services that the event is about.

ServiceEvent structure

Parameter

Mandatory or Optional

Type

Description

service_id

Mandatory

String

System field. The value is fixed to $log.

event_type

Mandatory

String

System field. The value is fixed to log_report.

event_time

Optional

String

Indicates the time when the event occurs.

paras

Mandatory

Object

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

paras structure

Parameter

Mandatory or Optional

Type

Description

timestamp

Optional

String

Indicates the log generation time.

type

Mandatory

String

Indicates the log type. Options:

DEVICE_STATUS: device status.

DEVICE_PROPERTY: device property.

DEVICE_MESSAGE: device message.

DEVICE_COMMAND: device command.

content

Mandatory

String

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"
        } 
    }] 
}