Links

Access Logs

Currently, the shipping of logs from the instances to the central storage is not implemented yet. The API endpoint already exists, but it always returns an empty response.
Every running MongoDB instance collects logs from MongoD. Currently, there is no option to change this configuration. The log messages are shipped to a central storage location with a retention policy of 30 days.
Using the cluster ID, you can access the logs for that cluster via the API.

Requesting logs

The endpoint for fetching logs has four optional query parameters:
Parameter
Description
Default value
Possible values
start
Retrieve log lines after this timestamp (format: RCF3339)
30 days ago
between 30 days ago and now (before end)
end
Retrieve log line before this timestamp (format: RFC3339)
now
between 30 days ago and now (after start)
direction
Direction in which the logs are sorted and limited
BACKWARD
BACKWARD or FORWARD
limit
Maximum number of log lines to retrieve. Which log lines are cut depends on direction
100
between 1 and 5000
If you omit all parameters, you will get the most recent 100 log messages.
The following example shows how to receive only the first two messages after 12:00 a.m. on January 5, 2022:
curl --include \
--request GET \
--user "[email protected]:Mb2.r5oHf-0t" \
--header "Content-Type: application/json" \
https://api.ionos.com/databases/mongodb/clusters/498ae72f-411f-11eb-9d07-046c59cc737e/logs?start=2022-01-05T12:00:00Z&end=2022-01-05T13:00:00Z&direction=FORWARD&limit=2

Response

The response contains the log messages separated per instance and looks similar to this:
{
"instances": [
{
"name": "ionos-498ae72f-411f-11eb-9d07-046c59cc737e-by6qu3m-1",
"messages": [
{
"time": "2022-01-05T12:00:29.793Z",
"message": "TODO"
},
{
"time": "2022-01-05T12:00:29.794Z",
"message": "TODO"
}
]
}
]
}