Method for Working with Logs

To work with logs, execute requests using the logs API method (determine user token before executing the request):

curl -X GET '<IP address or DNS server name>/api/v1/logs/schedule/' --header 'Authorization: Bearer <user token>' --header 'Accept: application/json'

The example of response:

{
    "fetch_policy_schedule_enable": true,
    "fetch_policy_schedule": "0 13 * * *",
    "send_logs_schedule_enable": true,
    "send_logs_schedule": "10 13 * * *",
    "log_level": 2,
    "weight_send_mb": 10,
    "weight_max_mb": 10,
    "log_sensitive_data": true,
    "is_syslog": true,
    "output": 1
}

The response contains device logging policy parameters.

curl -X POST '<IP address or DNS server name>/api/v1/logs/push/' --header 'Authorization: Bearer <user token>' --header 'Content-Type: application/json' -d '[{"time": "<time>","level": "<level>","data": "<text description of log>"}]'

To use the <time>, <level> substitutions, take the following into account:

The example of response:

{
    "status": "OK"
}

After the log is successfully sent, it will be located in the System Logs subsection.

See also:

Server API | Method for Working with Push Notifications