device_logs

Device Logs

Device logs gives all the information about the devices based on certain criteria. It gives us the device id for device log entry, MAC address for which the log is generated, device log type, log category like SYSTEM, NETWORK, RADIO etc., Log level which will have values like CRITICAL, ALERT, ERROR, INFO, and DEBUG with device event log description.

JSON Table

Parameter Data Type Description
id int ID for the device log entry.
deviceMac String MAC address of the device for which the log is generated.
typeId int Device log type.
category String Log category. Possible values are SYSTEM, NETWORK, RADIO, etc.
level String Log level. Applicable values are CRITICAL, ALERT, ERROR, INFO, and DEBUG.
creationDate Long Log entry creation time in milliseconds. (UTC format)
description String Device event log description.

Copy Sample JSON
Sample JSON
{
  "deviceLogs": [
    {
      "id": 180,
      "deviceMac": "00:11:74:86:28:7F",
      "typeId": 3,
      "category": "SYSTEM",
      "level": "INFO",
      "creationDate": 1477566002626,
      "description": "AP rebooted with reason: Reboot command recieved from server."
    },
    {
      "id": 181,
      "deviceMac": "00:11:74:86:28:7F",
      "typeId": 9,
      "category": "NETWORK",
      "level": "ALERT",
      "creationDate": 1477566002626,
      "description": "DHCP Lease expired for VLAN 1$s with IPv4."
    }
	 ]
}
API Calls

/V5/devicelogs

/V5/devicelogs/groupby

/V5/devices/sensors/debuglogs/{sessionId}

Get Device Logs

Description This API fetches the device logs depending on specified criteria.
Users with the following roles can call this API: super user, administrator,operator, and viewer.
Syntax
GET <Base_URL>/devicelogs

Here,

  • offset

    It is used to specify the starting entry in the device log from which the logs have to be fetched. It takes an integer value.

  • limit

    It is used to specify the number of entries starting from the specified offset that must be fetched from the device log. It takes an integer value

  • filter

    It is used to specify filter criteria for the device log entries. A sample format is:
    {“property”:”creationdate”,”value”:[1476114795365],”operator”:”=”}

  • property

    It is used to specify the property on which the logs must be fileterd. It takes a string value.
    The applicable values are category, devicemac, level, creationdate, and typeid.

  • value

    It is used to specify the value for the property.

  • operator

    It is used to specify the operation to be used to match the property and its value.

  • sortcolumn

    It is used to sort the results based on the specified column.
    The default value is creationdate. Applicable values are category, devicemac, level, creationdate, and typeid.

  • sortascending

    It is used to sort the result in the ascending order of the values in the sort column.
    It takes boolean value. The default value is false.

Sample code
GET https://training.mojonetworks.com/new/webservice/v5/devicelogs?offset=0&limit=10&sortcolumn=”category”&sortascending=”true
Request Body This API call does not require any request body parameters.
Response Body If the API call is successful, the HTTP response status is 200.
The response body contains the device logs. The response is in the application/json format

Get Device Logs Grouped By Criteria

Description This API fetches device logs and groups them based on the specified criteria.
Users with the following roles can call this API: super user, administrator,operator, and viewer
Syntax
GET <Base_URL>/devicelogs/groupby

Here,

  • groupby

    It is used to sepcify the columns on which the results must be grouped. Applicable values are category, devicemac, level, creationdate, and typeid.

Sample code
GET https://training.mojonetworks.com/new/webservice/v5/devicelogs/groupby?groupby=category&groupby=devicemac
Request Body This API call does not require any request body parameters.
Response Body If the API call is successful, the HTTP response status is 200.
The response body contains the device logs. The response is in the application/json format

Get Debug Logs For A Session

Description This API is used to fetch the debug logs for a particular session.
Users with the following roles can call this API: super user, administrator,operator, and viewer.
Syntax
GET <Base_URL>/devices/sensors/debuglogs/{sessionId}

Here,

  • sessionId

    It is used to specify Session ID for which debug file is requested.
    It takes Integer value. It is a mandatory field.
    You can obtain the session IDs by running the Get Sensor Debug Log History call.

  • uid

    It is the unique ID of the guest user account in the Guestbook plug-in that is being updated.

Sample code
GET https://training.mojonetworks.com/new/webservice/v5/devices/sensors/debuglogs/1
Request Body This API call does not require any request body parameters.
Response Body If the API call is successful, the HTTP response status is 200.
The response body contains a partial URL to access the debug logs. /td>