logs
Creates, updates, deletes, gets or lists a logs resource.
Overview
| Name | logs |
| Type | Resource |
| Id | clickhouse.postgres.logs |
Fields
The following fields are returned by SELECT queries:
- list
| Name | Datatype | Description |
|---|---|---|
body | string | Raw log entry body as emitted by PostgreSQL. Structured bodies are returned as a JSON-encoded string. |
severity | string | PostgreSQL severity of the entry (for example, LOG, WARNING, ERROR, FATAL, PANIC). |
timestamp | string (date-time) | Time the entry was logged (RFC 3339). |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | postgres_id, from_date, to_date, organization_id | body_contains, severity, sort_order, limit, offset | 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. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
from_date | string (date-time) | Inclusive start of the time window (RFC 3339 date-time). |
organization_id | string | ClickHouse Cloud organization ID. Resolved from the CLICKHOUSE_ORG_ID environment variable when it is set (x-stackQL-envVar); otherwise it must be supplied on every query as WHERE organization_id = <uuid>. A WHERE value always takes precedence over the environment. (x-stackQL-envVar: CLICKHOUSE_ORG_ID) |
postgres_id | string (uuid) | ID of the requested Postgres service. (wire: postgresId) |
to_date | string (date-time) | Inclusive end of the time window (RFC 3339 date-time). |
body_contains | string | Case-sensitive substring the log body must contain. |
limit | integer | Maximum number of results to return. |
offset | integer | Number of results to skip before returning. |
severity | string | Filter to log entries with this PostgreSQL severity (for example, ERROR, WARNING, LOG). |
sort_order | string | Sort order. One of asc or desc. |
SELECT examples
- list
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.
SELECT
body,
severity,
timestamp
FROM clickhouse.postgres.logs
WHERE postgres_id = '{{ postgres_id }}' -- required
AND from_date = '{{ from_date }}' -- required
AND to_date = '{{ to_date }}' -- required
AND organization_id = '{{ organization_id }}' -- required unless CLICKHOUSE_ORG_ID is set
AND body_contains = '{{ body_contains }}'
AND severity = '{{ severity }}'
AND sort_order = '{{ sort_order }}'
AND limit = '{{ limit }}'
AND offset = '{{ offset }}'
;