Skip to main content
Send logs straight into a ClickHouse table via the HTTP interface with JSONEachRow — your own log warehouse with SQL, no agent or pipeline in between.

Setup

  1. Create the target table:
  1. Set the environment variables (all optional for a default local instance):
  1. Wire the transport:
  1. Query: SELECT * FROM logs WHERE level = 'ERROR' ORDER BY timestamp DESC.

Environment Variables

Options

Plus the shared batching options: maxBatchSize, flushIntervalMs, timeout, retries — see the overview. Database and table names must be plain identifiers (letters, digits, underscores) — anything else throws at startup.

Payload

Each log becomes one JSONEachRow row. Meta flattens into the attributes map with values rendered as strings:
Query attributes with map access, e.g. WHERE attributes['status'] = '500'. The insert URL includes date_time_input_format=best_effort so ISO 8601 timestamps parse into DateTime64 directly. ClickHouse loves large batches — for high-volume services, raise maxBatchSize (e.g. 500) and flushIntervalMs (e.g. 5000) to cut down on tiny inserts.

Troubleshooting

  • 404 / UNKNOWN_TABLE — create the table first (DDL above), or check CLICKHOUSE_DATABASE / CLICKHOUSE_TABLE.
  • 516 — authentication failed; ClickHouse returns this for bad credentials.
  • Cannot parse errors — the table schema doesn’t match the row shape; align it with the DDL above or adjust column types.