Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#11991·coolify

[Bug]: API GET /databases/{uuid}/logs can return another database's logs

Author: esse-rodolfoCreated Sep 24, 2026Updated Sep 28, 2026
Labels🐛 Possible Bug🌐️ API

Description and Error Message

GET /api/v1/databases/{uuid}/logs can return the logs of a different database.

On my instance, a Redis database (chat-bullq-redis) returns the PostgreSQL log of chat-bullq-postgres, line for line (LOG: checkpoint complete: …). The other four databases on the same server return their own logs. The log page in the Coolify UI shows the right log for the Redis database.

No error is raised; the response is a normal 200 {"logs": "…"}.

Cause. The endpoint finds the container by the numeric database->id:

  • DatabasesController::logs_by_uuid calls getCurrentDatabaseContainerStatus($server, $database->id) and uses $containers->first().
  • getCurrentDatabaseContainerStatus runs docker ps -a --filter='label=coolify.databaseId={$id}'.

Each database engine has its own table (standalone_postgresqls, standalone_redis, …), so their ids are counted separately. A Redis and a PostgreSQL can have the same id, and both containers then carry the same coolify.databaseId label (defaultDatabaseLabels). The filter matches both, and first() picks whichever docker ps lists first. I can't see the internal ids through the API, but the behaviour matches: the two colliding databases return identical logs, and the others don't.

The UI isn't affected because Livewire/Project/Shared/Logs.php opens the database container by its uuid, and database containers are named by uuid ($container_name = $this->database->uuid in StartRedis, StartPostgresql, …).

Possible fix. Look the container up by name, which is unique: getContainerLogs($server, $database->uuid, …). Or add label=coolify.database.subType={$database->type()} to the filter. The label is already set by defaultDatabaseLabels.

Expected Behavior

  1. GET /api/v1/databases/{uuid}/logs returns the logs of the container whose name is {uuid}.
  2. Two databases of different engines never return each other's logs.

Steps to Reproduce

  1. Create a PostgreSQL database and a Redis database whose internal id is the same. For example, on a fresh instance the first database of each engine gets id = 1.
  2. Start both.
  3. curl -H "Authorization: Bearer $TOKEN" "https://<instance>/api/v1/databases/<redis_uuid>/logs?lines=5"
  4. The response contains the PostgreSQL log instead of the Redis log.

Example Repository URL

No response

Coolify Version

v4.3.23. The same code is on main at 70631d2.

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

No response

Additional Information

The same lookup is used by the Livewire logs component, but there the uuid-named container is picked explicitly for databases, so the UI shows the right log. The API is the only path I found that returns the wrong one.

Source: coollabsio/coolify

View original on GitHubView discussion on GitHub