Skip to content

Change a server's log clean-up

PUT /v1/servers/{serverId}/logs/settings

Sets how the server cleans up its logs: automatically every hour or not, how long old copies are kept, how large a log may grow, and whether to free up space when the disk is nearly full. The settings are put in place on the server in the background (state: "applying", then applied). The server must be running. Turning automatic clean-up off always works.

Scopes

The token needs this scope. Without it, the request is refused with insufficient_scope (see Scopes).

servers:write
Manage servers. Power, reboot, snapshots and restores, log settings, restarting PHP, server security (Imunify360), and connecting your own servers.

Headers

FieldType and description
Idempotency-Key

string 1 to 255 characters

A key of your own for this request, like a UUID: letters, digits and _ - : . Send the request again with the same key (after a timeout, say) and it's done only once. Keys are kept for 24 hours (see Idempotency).

Path parameters

FieldType and description
serverId Required

string

The server's id.

Request body

JSON, with these fields. Fields that aren't listed are refused.

FieldType and description
autoClean Required

boolean

Clean up old logs automatically, every hour.

keepDays Required

number

How many days old copies of logs are kept: 1, 3, 7, 14, 30, 90.

One of: 137143090

maxSizeMb Required

number

The size, in MB, a log may reach before it's rotated: 10, 50, 100, 250, 500, 1000.

One of: 10501002505001000

freeSpace Required

boolean

Free up space from logs when the disk is over 90% full.

Example request

curl -X PUT "https://api.rabbitflare.com/v1/servers/3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d/logs/settings" \
  -H "Authorization: Bearer $RABBITFLARE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "autoClean": true,
  "keepDays": 7,
  "maxSizeMb": 100,
  "freeSpace": true
}'

Response

200 OK Returns the ServerLogSettings object in data.

The ServerLogSettings object's fields 6 fields
FieldType and description
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

applied: the server uses these settings. applying: they're being put in place. failed: they couldn't be (see error).

Known values: appliedapplyingfailed More can appear.

error

string or null

Why the settings couldn't be put in place. Null otherwise.

Example response

200 OK
{
  "data": {
    "autoClean": true,
    "keepDays": 7,
    "maxSizeMb": 100,
    "freeSpace": true,
    "state": "applying",
    "error": 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 codeWhen, and what to do
403 feature_unavailable

This product isn't open to the account.

Contact support if you'd like it opened.

404 not_found

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_unavailable

The server isn't in a state that allows this (for example, it's off or still being set up).

Start the server, or wait until it's active, then try again.

409 busy

Another change is still in progress on this server or site, or something else under way stops this one for now (a site backup running on the server, the server's backups being moved): message says what.

Wait until it finishes, then try again. A change to the server or site itself is done when its pendingAction is null again; for anything else, message says how long to wait.

409 server_restoring

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 pendingAction is null again), then try again. A restore that stopped partway keeps pendingAction: "restore", with the server's lastError set, until our team has checked the server.

422 validation_failed

One or more fields are missing or wrong. fields names each one with what's wrong.

Correct the fields named in fields. Unknown fields are refused too.

Rate limit

Write requests: 30 a minute per token, 60 per account. More in Rate limits.

Added on .

Popular

API docs