Access Logs

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.

Endpoint

Use the following endpoint to get logs: https://api.ionos.com/databases/mongodb/clusters/{clusterId}/logs

circle-info

Note: The sample cluster UUID is 498ae72f-411f-11eb-9d07-046c59cc737e.

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:

Request

curl --include \
    --request GET \
    --user "[email protected]:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \

Response

The response contains the log messages separated per instance and looks similar to this:

Last updated

Was this helpful?