> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# List Postgres server logs

> **This endpoint is in beta.** API contract is stable, and no breaking changes are expected in the future. <br /><br /> Returns PostgreSQL server log entries for a Postgres service within the given time window, most recent first by default (override with `sort_order`). Results are paginated with `limit`/`offset`; advance `offset` until a page returns fewer than `limit` entries to read the full window. The time range must not exceed 30 days, and `to_date` must be after `from_date`.

<span data-endpoint-badge="Beta"><Badge color="blue">Beta</Badge></span>

**This endpoint is in beta.** API contract is stable, and no breaking changes are expected in the future. <br /><br /> Returns PostgreSQL server log entries for a Postgres service within the given time window, most recent first by default (override with `sort_order`). Results are paginated with `limit`/`offset`; advance `offset` until a page returns fewer than `limit` entries to read the full window. The time range must not exceed 30 days, and `to_date` must be after `from_date`.


## OpenAPI

````yaml _specs/cloud-openapi.json GET /v1/organizations/{organizationId}/postgres/{postgresId}/logs
openapi: 3.1.2
info:
  title: OpenAPI spec for ClickHouse Cloud
  version: '1.0'
  contact:
    name: ClickHouse Support
    url: >-
      https://clickhouse.com/docs/en/cloud/manage/openapi?referrer=openapi-1057301
    email: support@clickhouse.com
servers:
  - url: https://api.clickhouse.cloud
security:
  - basicAuth: []
tags:
  - name: Organization
  - name: User management
  - name: Billing
  - name: Role Management
  - name: Service
  - name: Backup
  - name: OpenAPI
  - name: Prometheus
  - name: ClickPipes
  - name: ClickStack
  - name: Postgres
  - name: UDF
paths:
  /v1/organizations/{organizationId}/postgres/{postgresId}/logs:
    get:
      tags:
        - Postgres
      summary: List Postgres server logs
      description: >-
        **This endpoint is in beta.** API contract is stable, and no breaking
        changes are expected in the future. <br /><br /> Returns PostgreSQL
        server log entries for a Postgres service within the given time window,
        most recent first by default (override with `sort_order`). Results are
        paginated with `limit`/`offset`; advance `offset` until a page returns
        fewer than `limit` entries to read the full window. The time range must
        not exceed 30 days, and `to_date` must be after `from_date`.
      operationId: postgresLogsGetList
      parameters:
        - in: path
          name: organizationId
          description: ID of the organization that owns the Postgres service.
          required: true
          schema:
            type: string
            format: uuid
        - in: path
          name: postgresId
          description: ID of the requested Postgres service.
          required: true
          schema:
            type: string
            format: uuid
        - in: query
          name: from_date
          description: Inclusive start of the time window (RFC 3339 date-time).
          schema:
            type: string
            format: date-time
          required: true
        - in: query
          name: to_date
          description: Inclusive end of the time window (RFC 3339 date-time).
          schema:
            type: string
            format: date-time
          required: true
        - in: query
          name: body_contains
          description: Case-sensitive substring the log body must contain.
          schema:
            type: string
        - in: query
          name: severity
          description: >-
            Filter to log entries with this PostgreSQL severity (for example,
            ERROR, WARNING, LOG).
          schema:
            type: string
        - in: query
          name: sort_order
          description: Sort order. One of `asc` or `desc`.
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - in: query
          name: limit
          description: Maximum number of results to return.
          schema:
            type: integer
            minimum: 1
            maximum: 2000
            default: 50
        - in: query
          name: offset
          description: Number of results to skip before returning.
          schema:
            type: integer
            minimum: 0
            default: 0
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: number
                    description: HTTP status code.
                    example: 200
                  requestId:
                    type: string
                    description: Unique id assigned to every request. UUIDv4
                    format: uuid
                  result:
                    type: array
                    items:
                      $ref: '#/components/schemas/PostgresLogEntry'
        '400':
          description: >-
            The request cannot be processed due to a client error. Please verify
            your request parameters and try again.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: number
                    description: HTTP status code.
                    example: 400
                  error:
                    type: string
                    description: Detailed error description.
                  requestId:
                    type: string
                    description: Unique id assigned to every request. UUIDv4
                    format: uuid
        '500':
          description: >-
            An internal server error has occurred. If this issue persists,
            please contact ClickHouse Cloud support for assistance.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: HTTP status code.
                    example: 500
                  error:
                    type: string
                    description: Detailed error description.
                  requestId:
                    type: string
                    description: Unique id assigned to every request. UUIDv4
                    format: uuid
components:
  schemas:
    PostgresLogEntry:
      properties:
        timestamp:
          description: Time the entry was logged (RFC 3339).
          type: string
          format: date-time
        severity:
          description: >-
            PostgreSQL severity of the entry (for example, LOG, WARNING, ERROR,
            FATAL, PANIC).
          type: string
        body:
          description: >-
            Raw log entry body as emitted by PostgreSQL. Structured bodies are
            returned as a JSON-encoded string.
          type: string
      required:
        - timestamp
        - severity
        - body
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >-
        Use key ID and key secret obtained in ClickHouse Cloud console:
        https://clickhouse.com/docs/cloud/manage/openapi

````