Skip to content

Get Event Log

Returns an array of event log records.

Request

HTTP Request

GET /node/api/event-log

Path parameters

No parameters required.

Query parameters

Parameter Type Description
filter String
optional
A JSON-encoded filter for log records.
from Integer optional A lower bound timestamp for event log records.
inverse Boolean
optional
Whether to inverse the order of items.
limit String optional The maximum number of records to be retrieved.
skip String optional The number of the first records to be skipped.
sortDirection String
optional
A sorting direction. asc for ascending, desc for descending. The first parameter is used by default.
sortField String
optional
The name of a field used to sort records.
to Integer optional An upper bound timestamp for event log records.
type String
optional
A message type. 1 for SNMP Trap, 2 for MQTT message.

Request body

The request body is empty.

Response

Returns the array of event log records. See the Event Log model for more information.

Example

Request

login=<...>
password=<...>
saymon_hostname=<...>
url=https://$saymon_hostname/node/api/event-log

curl -X GET $url -u $login:$password
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/event-log";
let auth = "Basic " + btoa(login + ":" + password);

let headers = new Headers();
headers.append("Authorization", auth);

let requestOptions = {
    method: "GET",
    headers: headers
};

fetch(saymonHostname + path, requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log("error", error));
const http = require("http");

let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/event-log/";
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");

let options = {
    "method": "GET",
    "hostname": saymonHostname,
    "headers": {
        "Authorization": auth
    },
    "path": path
};

let req = http.request(options, function (res) {
    let chunks = [];

    res.on("data", function (chunk) {
        chunks.push(chunk);
    });

    res.on("end", function (chunk) {
        let body = Buffer.concat(chunks);
        console.log(body.toString());
    });

    res.on("error", function (error) {
        console.error(error);
    });
});

req.end();
import requests

login = <...>
password = <...>
saymon_hostname = <...>
url = "https://" + saymon_hostname + "/node/api/event-log"

response = requests.request("GET", url, auth=(login, password))
print(response.text)

Response

[
    {
        "_id": "595fa179177fb97b0fa46c0d",
        "type": "snmp-trap",
        "agentId": "384",
        "payload": {
            "senderAddress": "127.0.0.1",
            "bindings": "...",
            "trapOid": ".1.3.6.1.4.1.5089.1.0.10",
            "text": "0"
        },
        "timestamp": 1499439481805,
        "entity": {
            "entityId": "56741c9ba4c004d455959550",
            "entityType": 1,
            "entityName": "Another SNMP Trap"
        }
    },
    ...
]

See Also