Documentation / ClickHouse

Add ClickHouse when Postgres stops being enough for analytics.

ClickHouse is optional. Use it when you want high-scale event querying, dedicated analytics storage, or a cleaner separation between the control-plane app database and raw event analysis.

When to enable it

Stay on Postgres first, then add ClickHouse for scale.

ClickHouse is most helpful once you want heavier event analytics or larger retention windows. The core app still uses PostgreSQL for users, projects, memberships, and API keys.

Environment

Set the ClickHouse connection variables explicitly.

shell
LOGISTER_CLICKHOUSE_ENABLED=true
LOGISTER_CLICKHOUSE_URL=http://127.0.0.1:8123
LOGISTER_CLICKHOUSE_DATABASE=logister
LOGISTER_CLICKHOUSE_EVENTS_TABLE=events_raw
LOGISTER_CLICKHOUSE_USERNAME=default
LOGISTER_CLICKHOUSE_PASSWORD=
REDIS_URL=redis://127.0.0.1:6379/0

LOGISTER_CLICKHOUSE_URL can point at either a native ClickHouse HTTP endpoint or a ClickHouse Query API endpoint.

Schema setup

Initialize schema and keep the starter SQL nearby.

  • Schema and materialized view: docs/clickhouse_schema.sql
  • Starter dashboard queries: docs/clickhouse_dashboard_queries.sql
shell
cat docs/clickhouse_schema.sql | curl "http://127.0.0.1:8123" --data-binary @-

Health checks

Use the ClickHouse health endpoint to verify the dependency.

  • GET /health/clickhouse returns 200 when disabled or healthy
  • GET /health/clickhouse returns 503 when enabled but unreachable

Payload mapping

Know how Logister event payloads land in ClickHouse columns.

ClickHouse columnPayload source
project_idAuthenticated API key project
api_key_idAuthenticated API key id
occurred_atevent.occurred_at with a Rails fallback if absent
event_typeevent.event_type
levelevent.level
fingerprintevent.fingerprint or the generated fallback
messageevent.message
environmentevent.context.environment or Rails.env
serviceevent.context.service or the project slug
releaseevent.context.release
exception_classevent.context.exception_class or event.context.exception.class
transaction_nameevent.context.transaction_name
tagsevent.context.tags
context_jsonThe full event.context object