Get Security Log

Returns security log.

Request

HTTP Request

GET /node/api/users/security/log

Permissions

read-security-log

Query parameters

Parameter Type Description

from

Integer

A lower-bound timestamp for log records.

limit

Integer

The maximum number of records to be retrieved.

skip

Integer

The number of the first records to be skipped.

to

Integer

An upper-bound timestamp for log records.

filter

String

Additional filter for field data as url-encoded JSON. Filter has the following structure: "field": "value"

Request body

Request body is empty.

Response

Response contains an array of security log entries. See the Security Log model for more information.

Examples

Request

  • Bash

  • JavaScript

  • NodeJS

  • Python

login=<...>
password=<...>
saymon_hostname=<...>
userId=<...>
url=https://$saymon_hostname/node/api/users/security/log

curl -X GET $url -u $login:$password \
    -G --data-urlencode "userId=$userId"
let login = <...>
let password = <...>
let saymonHostname = <...>
let userId = <...>
let path = "/node/api/users/security/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 userId = <...>
let path = "/node/api/users/security/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 = <...>
user_id = <...>
url = "https://" + saymon_hostname + "/node/api/users/security/log"

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

Response

[
	{
	    "level": "error",
	    "severity": "8",
	    "eventClassId": "AAF",
	    "eventDescription": "Authorization error",
	    "host": "saymon-server",
	    "message": {
	        "remoteAddress": "127.0.0.1",
	        "login": "demo",
	        "message": "Wrong password"
	    },
	    "extra": {
	        "source": "saymon-log-kafka.LOG_FAULTS",
	        "channel": "faults"
	    },
	    "timestamp": "2023-09-20T12:39:06.334Z",
	    "id": "650ae7ebcb1c340011c49648"
	},
]