2017-11-18 19:19:18 -06:00
All the `list_*logs` calls are aliased to `list_logs` .
Retrieve all logs or logs for a specific device.
2019-06-20 13:53:45 -05:00
- id or hostname is the specific device
2017-11-18 19:19:18 -06:00
2019-07-30 14:20:14 -07:00
Input:
2017-11-18 19:19:18 -06:00
2019-06-20 13:53:45 -05:00
- start: The page number to request.
- limit: The limit of results to be returned.
2021-01-28 15:50:58 +01:00
- from: The date and time or the event id to search from.
- to: The data and time or the event id to search to.
2017-11-18 19:19:18 -06:00
### `list_eventlog`
2019-06-20 13:53:45 -05:00
2017-11-18 19:19:18 -06:00
Route: `/api/v0/logs/eventlog/:hostname`
### `list_syslog`
2019-06-20 13:53:45 -05:00
2017-11-18 19:19:18 -06:00
Route: `/api/v0/logs/syslog/:hostname`
### `list_alertlog`
2019-06-20 13:53:45 -05:00
2017-11-18 19:19:18 -06:00
Route: `/api/v0/logs/alertlog/:hostname`
### `list_authlog`
2019-06-20 13:53:45 -05:00
Route: `/api/v0/logs/authlog/:hostname`
2017-11-18 19:19:18 -06:00
Example:
2019-06-20 13:53:45 -05:00
2017-11-18 19:19:18 -06:00
```curl
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/logs/eventlog/:hostname
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/logs/syslog/:hostname?limit=20
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/logs/eventlog/:hostname?limit=20& start=5& from=2017-07-22%2023:00:00
2022-11-08 17:20:34 +00:00
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/logs/eventlog/:hostname?sortorder=DESC
2017-11-18 19:19:18 -06:00
```
Output:
2019-06-20 13:53:45 -05:00
2017-11-18 19:19:18 -06:00
```json
{
"status": "ok",
2018-02-01 20:52:38 +01:00
"message": "",
2017-11-18 19:19:18 -06:00
"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"
}
]
}
```
2023-03-15 14:14:38 +01:00
### `syslogsink`
Route: `/api/v0/logs/syslogsink`
Accept any json messages and passes to further syslog processing. single messages or an array of multiple messages is accepted. see [Syslog ](../Extensions/Syslog.md ) for more details and logstash integration
Example
```
curl -L -X POST 'https://sink.librenms.org/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"
}
]'
```