JSONEachRow — your own log warehouse with SQL, no agent or pipeline in between.
Setup
- Create the target table:
- Set the environment variables (all optional for a default local instance):
- Wire the transport:
- 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 oneJSONEachRow row. Meta flattens into the attributes map with values rendered as strings:
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 checkCLICKHOUSE_DATABASE/CLICKHOUSE_TABLE.516— authentication failed; ClickHouse returns this for bad credentials.Cannot parseerrors — the table schema doesn’t match the row shape; align it with the DDL above or adjust column types.