Access Logs

The logs that are generated by a database are stored temporarily on the same disk as the database. We provide logs for connections, disconnections, waiting for locks, DDL statements, any statement that ran for at least 500 ms, and any statement that caused an error (see postgreSQL documentation). Currently, we do not provide an option to change this configuration.

In order to conserve disk space, log files are rotated according to size. Logs should not consume more than 175 MB of disk storage. The files are continuously monitored and log messages are shipped to a central storage location with a retention policy of 30 days.

By using your cluster ID, you can fetch the logs for that cluster via our API.

Requesting logs

The endpoint for fetching logs has four optional query parameters:

ParameterDescriptionDefault valuePossible 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

So if you omit all parameters, you get the latest 100 log lines.

curl --include \
    --request GET \
    --user "clientname@ionos.com:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \
    https://api.ionos.com/databases/postgresql/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 will contain the logs separated per instance and look similar to this (of course with different timestamps, log contents etc):

{
  "instances": [
    {
      "name": "ionos-498ae72f-411f-11eb-9d07-046c59cc737e-by6qu3m-1",
      "messages": [
        {
          "time": "2022-01-05T12:00:29.793Z",
          "message": "2022-01-05 12:00:29.793 UTC,,,107077,\"[local]\",61d5885d.1a245,1,\"\",2022-01-05 12:00:29 UTC,,0,LOG,00000,\"connection received: host=[local]\",,,,,,,,,\"\",\"not initialized\""
        },
        {
          "time": "2022-01-05T12:00:29.794Z",
          "message": "2022-01-05 12:00:29.794 UTC,\"postgres\",\"test\",107078,\"[local]\",61d5885d.1a246,2,\"authentication\",2022-01-05 12:00:29 UTC,9/73319,0,LOG,00000,\"connection authorized: user=postgres database=test application_name=pgq ticker\",,,,,,,,,\"\",\"client backend\""
        }
      ]
    }
  ]
}

Last updated