Skip to content

Logs

All the list_*logs calls are aliased to list_logs.

Retrieve all logs or logs for a specific device.

  • id or hostname is the specific device

Input:

  • start: the page number of the request.
  • limit: the maximum number of results.
  • from: the start date and time, or the start event id, of the search.
  • to: the end date and time, or the end event id, of the search.

list_eventlog

Route: /api/v0/logs/eventlog/:hostname

list_syslog

Route: /api/v0/logs/syslog/:hostname

list_alertlog

Route: /api/v0/logs/alertlog/:hostname

list_authlog

Route: /api/v0/logs/authlog

Example:

curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://foo.example/api/v0/logs/eventlog/:hostname
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://foo.example/api/v0/logs/syslog/:hostname?limit=20
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://foo.example/api/v0/logs/eventlog/:hostname?limit=20&start=5&from=2017-07-22%2023:00:00
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://foo.example/api/v0/logs/eventlog/:hostname?sortorder=DESC

Output:

{
    "status": "ok",
    "message": "",
    "count": 5,
    "total": "15",
    "logs": [
        {
            "hostname": "localhost",
            "sysName": "web01.1.novalocal",
            "event_id": "10050349",
            "host": "279",
            "device_id": "279",
            "datetime": "2017-07-22 19:57:47",
            "message": "ifAlias:  ->  <pptp-something-something-tunnel-something>",
            "type": "interface",
            "reference": "NULL",
            "username": "",
            "severity": "3"
        },
        ....
        {
            "hostname": "localhost",
            "sysName": "web01.1.novalocal",
            "event_id": "10050353",
            "host": "279",
            "device_id": "279",
            "datetime": "2017-07-22 19:57:47",
            "message": "ifHighSpeed:  ->  0",
            "type": "interface",
            "reference": "NULL",
            "username": "",
            "severity": "3"
        }
    ]
}

syslogsink

Route: /api/v0/syslogsink

Accept any json messages and passes to further syslog processing. single messages or an array of multiple messages is accepted. see Syslog for more details and logstash integration

Example

curl -L -X POST 'https://sink.foo.example/api/v0/syslogsink/' -H 'X-Auth-Token: xxxxxxxLibreNMSApiToken' --data-raw '[   
    {
        "msg": "kernel: minimum Message",
        "host": "mydevice.fqdn.com"
    },
    {
        "msg": "Line protocol on Interface GigabitEthernet1/0/41, changed state to up",
        "facility": 23,
        "priority": "189",
        "program": "LINEPROTO-5-UPDOWN",
        "host": "172.29.10.24",
        "@timestamp": "2022-12-01T20:14:28.257Z",
        "severity": 5,
        "level": "ERROR"
    },
    {
        "msg": "kernel: a unknown host",
        "host": "unknown.fqdn.com"
    }
]'

add_eventlog

Route: /api/v0/devices/:hostname/eventlog

Adds events to a device's eventlog.

Example

curl -k -X POST -d '{"text": "Eventlog entry - Severity:Ok","severity":"1"}' -H 'X-Auth-Token: YOURAPITOKENHERE' https://foo.example/api/v0/devices/127.0.0.1/eventlog
curl -k -X POST -d '{"text": "Eventlog entry - Severity:Info","severity":"2"}' -H 'X-Auth-Token: YOURAPITOKENHERE' https://foo.example/api/v0/devices/127.0.0.1/eventlog
curl -k -X POST -d '{"text": "Eventlog entry - Severity:Notice","severity":"3"}' -H 'X-Auth-Token: YOURAPITOKENHERE' https://foo.example/api/v0/devices/127.0.0.1/eventlog
curl -k -X POST -d '{"text": "Eventlog entry - Severity:Warning","severity":"4"}' -H 'X-Auth-Token: YOURAPITOKENHERE' https://foo.example/api/v0/devices/127.0.0.1/eventlog
curl -k -X POST -d '{"text": "Eventlog entry - Severity:Error with CustomType","severity":"5","type":"CustomType"}' -H 'X-Auth-Token: YOURAPITOKENHERE' https://foo.example/api/v0/devices/127.0.0.1/eventlog