---
search:
  tags:
    - databases
    - POST
seo:
  description: >-
    Re… Reference for the POST
    /project/{project_id}/environment/{environment_id}/database/{database_id}/runs/{component_run_id}/logs
    endpoint in the Platform API.
sidebar:
  label: Query database run logs
  badge: POST
title: Query database run logs
type: openapi-operation
---
Returns the deployment logs of one database run: what Kapten did while deploying it, and what its agent on the cluster did. For the database's own output, use the component logs.

Without `from` or `to`, the window spans the run, from its start to its end. Logs follow the retention of the log backend, so the logs of an old run may be gone, and runs from before run logs existed return an empty list.

`POST /project/{project_id}/environment/{environment_id}/database/{database_id}/runs/{component_run_id}/logs`

**Request body** (`application/json`, required)

- `view` (string) — Which run log projection to return.
- `from` (string<date-time>) — Inclusive lower bound for the run log time range.
- `to` (string<date-time>) — Inclusive upper bound for the run log time range.
- `limit` (integer<int32>) — Maximum number of most recent raw backend records to query.
- `levels` (string[]) — Optional log levels to include.
- `source` (string[]) — Optional timeline event sources to include.
- `text` (string) — Optional phrase to search in the log message.

Request body example, Timeline only:

```json
{
  "view": "timeline",
  "limit": 200,
  "source": [
    "control_plane",
    "agent"
  ]
}
```

Request body example, Raw run-scoped records only:

```json
{
  "view": "raw",
  "levels": [
    "info",
    "warn",
    "error"
  ],
  "text": "helm"
}
```

Request body example, Timeline and raw records:

```json
{
  "view": "both",
  "from": "2026-07-03T10:00:00Z",
  "to": "2026-07-03T10:30:00Z",
  "limit": 500
}
```

**Responses**

- `200` — Database run logs retrieved successfully
- `default` — Error

Response example, 200:

```json
{
  "timeline": [
    {
      "time": "string",
      "level": "string",
      "source": "string",
      "step": "string",
      "phase": "string",
      "backend": "string",
      "backend_step": "string",
      "message": "string",
      "metadata": {},
      "duration_ms": 0,
      "run_status": "string",
      "error_kind": "string",
      "event": "kapten.build.phase",
      "event_version": 0,
      "platform": "linux/amd64",
      "publication": "child_manifest"
    }
  ],
  "logs": [
    {
      "msg": {},
      "time": "string",
      "level": "string",
      "project_id": "string",
      "environment_id": "string",
      "component_id": "string",
      "component_type": "string",
      "component_run_id": "string",
      "component_kind": "string",
      "source": "control_plane",
      "step": "string",
      "phase": "string",
      "backend": "string",
      "backend_step": "string",
      "run_status": "string",
      "duration_ms": 0,
      "error_kind": "string",
      "metadata": {},
      "event": "kapten.build.phase",
      "event_version": 0,
      "platform": "linux/amd64",
      "publication": "child_manifest"
    }
  ],
  "meta": {
    "component_run_id": "6037affb-fb72-4f94-b0fb-f75a6be340e1",
    "logs_backend": "victoria_logs",
    "default_time_range_applied": true,
    "details_available": true,
    "details_unavailable_reason": "string",
    "pipeline_context": {
      "pipeline_id": "ec036e81-7903-4e4d-bbfa-ac8516341cf0",
      "pipeline_run_id": "54f73fac-6036-4081-9795-457321f22c71",
      "stage_run_id": "c6c7d692-4cdb-4e1f-9d55-db374c0d6d91",
      "pipeline_component_run_id": "63b3c0d9-c480-488a-860f-86e87cc881ec",
      "stage_component_id": "72d6951a-769e-47ac-a30e-c5b161d3f1fd",
      "required": true,
      "timeout_seconds": 0
    }
  }
}
```
