Get a server's logs and clean-up settings
/v1/servers/{serverId}/logs How much room the server's logs take (the system's own logs by group, and each site's) and how they're cleaned up. The sizes are read from the server while it's running, which can take a few seconds; otherwise usage is null and usageError says why.
Scopes
The token needs this scope. Without it, the request is refused with insufficient_scope (see Scopes).
-
servers:read - View servers. See servers, their graphs, snapshots, logs and security (Imunify360).
Path parameters
| Field | Type and description |
|---|---|
serverId Required | string The server's id. |
Example request
curl "https://api.rabbitflare.com/v1/servers/3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d/logs" \
-H "Authorization: Bearer $RABBITFLARE_TOKEN" const res = await fetch("https://api.rabbitflare.com/v1/servers/3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d/logs", {
headers: {
Authorization: `Bearer ${process.env.RABBITFLARE_TOKEN}`,
},
});
if (!res.ok) throw new Error(`Rabbitflare API error ${res.status}: ${await res.text()}`);
const { data } = await res.json();
console.log(data); import { Rabbitflare } from "@rabbitflare/api";
const rf = new Rabbitflare({ token: process.env.RABBITFLARE_TOKEN });
const data = await rf.servers.logs.get({ serverId: "3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d" });
console.log(data); <?php
$ch = curl_init('https://api.rabbitflare.com/v1/servers/3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d/logs');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RABBITFLARE_TOKEN'),
],
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($body === false || $status >= 400) {
throw new RuntimeException("Rabbitflare API error $status: $body");
}
print_r(json_decode($body, true)['data']); import os
import requests
response = requests.get(
"https://api.rabbitflare.com/v1/servers/3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d/logs",
headers={
"Authorization": "Bearer " + os.environ["RABBITFLARE_TOKEN"],
},
timeout=120,
)
response.raise_for_status()
print(response.json()["data"]) Response
200 OK Returns the ServerLogs object in data.
The ServerLogs object's fields 34 fields
| Field | Type and description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
settings | object How the server cleans up its logs. | ||||||||||||||||
autoClean | boolean Whether old logs are cleaned up automatically, every hour. | ||||||||||||||||
keepDays | integer How many days old copies of logs are kept: 1, 3, 7, 14, 30, 90. | ||||||||||||||||
maxSizeMb | integer The size, in MB, a log may reach before it's rotated: 10, 50, 100, 250, 500, 1000. | ||||||||||||||||
freeSpace | boolean Whether space is freed up from logs when the disk is over 90% full. | ||||||||||||||||
state | string
Known values: | ||||||||||||||||
error | string or null Why the settings couldn't be put in place. Null otherwise. | ||||||||||||||||
usage | object or null How much room the logs take, read from the server. Null while the server isn't running or didn't answer (see | ||||||||||||||||
disk | object The server's disk. Show its 4 fields
| ||||||||||||||||
logsBytes | integer Space all logs take. | ||||||||||||||||
groups | array of objects The system's own logs, by group. Show its 6 fields
| ||||||||||||||||
sites | array of objects Each site's logs. Show its 7 fields
| ||||||||||||||||
lastAutoClean | object or null The last automatic clean-up. Null when there hasn't been one. Show its 2 fields
| ||||||||||||||||
autoCleanOn | boolean Whether the server's hourly clean-up is set up and on right now. | ||||||||||||||||
usageError | string or null Why |
Example response
{
"data": {
"settings": {
"autoClean": true,
"keepDays": 7,
"maxSizeMb": 100,
"freeSpace": true,
"state": "applied",
"error": null
},
"usage": {
"disk": {
"totalBytes": 85899345920,
"usedBytes": 18253611008,
"freeBytes": 67645734912,
"usedPercent": 21.3
},
"logsBytes": 412090368,
"groups": [
{
"id": "web",
"title": "Web server",
"bytes": 201326592,
"currentBytes": 12582912,
"oldBytes": 188743680,
"journalBytes": null
}
],
"sites": [
{
"siteId": "8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
"name": "Shop",
"stagingCopy": false,
"bytes": 52428800,
"phpBytes": 1048576,
"debugBytes": 50331648,
"oldBytes": 1048576
}
],
"lastAutoClean": {
"ranAt": "2026-11-18T08:00:03.000Z",
"freedBytes": 10485760
},
"autoCleanOn": true
},
"usageError": null
}
} Errors
The errors this request can answer besides those every request can (a missing token, a missing scope, the rate limits). Each answer is an Error object (see Errors).
| Status and code | When, and what to do |
|---|---|
403 feature_ | This product isn't open to the account. Contact support if you'd like it opened. |
404 not_ | The resource doesn't exist, or isn't this account's. Check the id. Ids of other accounts' resources answer the same way. |
409 server_ | The server is being restored, and nothing else can change it or its sites until that's done. Wait until the restore finishes (the server's |