## Get service logs

**get** `/projects/{project_id}/services/{service_id}/logs`

Fetch logs for a specific service. Returns up to 500 log entries in reverse
chronological order. Supports cursor-based pagination via the `cursor` parameter
and the `lastCursor` field in the response.

**Recommended pagination:** omit `page` (or pass `page=0`) and use the returned
`lastCursor` value as the `cursor` parameter on subsequent requests to page
through all available logs without hitting any result-window limits.

**Legacy pagination:** passing `page > 0` without a `cursor` uses the older
offset-based approach, which is limited to the first 10,000 log entries.

### Path Parameters

- `project_id: string`

- `service_id: string`

### Query Parameters

- `cursor: optional string`

  Opaque pagination cursor returned as `lastCursor` in a previous response.
  When provided, returns the next page of logs older than the cursor position.
  Takes precedence over the `page` parameter.

- `node: optional number`

  Specific service node to fetch logs from (for multi-node services).

- `page: optional number`

  Page number for pagination (0-based). When omitted or set to 0, cursor-based
  pagination is used automatically. Values greater than 0 use the legacy
  offset path (deprecated; prefer cursor pagination).

- `search: optional array of string`

  Full-text search terms to filter log lines. Repeat the parameter for multiple values
  (e.g. `?search=slow+query&search=ERROR`).
  Only applies when using cursor-based pagination (page=0 or cursor provided).

- `severities: optional array of string`

  Severity levels to filter results. Repeat the parameter for multiple values
  (e.g. `?severities=ERROR&severities=WARNING`).
  Only applies when using cursor-based pagination (page=0 or cursor provided).

- `since: optional string`

  Lower bound timestamp — fetch logs after this time (RFC3339 format).
  Only applies when using cursor-based pagination (page=0 or cursor provided).

- `until: optional string`

  Upper bound timestamp — fetch logs before this time (RFC3339 format, e.g., 2024-01-15T10:00:00Z).

### Returns

- `logs: array of string`

  Array of log message strings. Preserved for backwards compatibility.

- `entries: optional array of object { message, severity, timestamp }`

  Structured log entries with timestamp and severity metadata.
  Only present on the cursor-based path (page=0 or cursor provided).
  Entries are in the same order as logs and can be used in place of it
  by callers that need structured data.

  - `message: string`

    Log message text.

  - `severity: string`

    PostgreSQL severity level (e.g. LOG, WARNING, ERROR, FATAL).

  - `timestamp: string`

    Timestamp of the log entry (RFC3339 format).

- `lastCursor: optional string`

  Opaque cursor for the next page of results. Present when more log entries
  exist older than the last entry in this response. Pass this value as the
  `cursor` query parameter to retrieve the next page. Absent when there are
  no further results.

### Example

```http
curl https://console.cloud.tigerdata.com/public/api/v1/projects/$PROJECT_ID/services/$SERVICE_ID/logs \
    -H "Authorization: Bearer $TIGER_CLOUD_API_KEY"
```

#### Response

```json
{
  "logs": [
    "string"
  ],
  "entries": [
    {
      "message": "database system is ready to accept connections",
      "severity": "LOG",
      "timestamp": "2025-01-15T09:30:00Z"
    }
  ],
  "lastCursor": "eyJ0cyI6IjIwMjUtMDEtMTVUMDk6MzA6MDBaIn0="
}
```
