Skip to main content

Module clickhouse_logger

Module clickhouse_logger 

Source
Expand description

ClickHouse access-logger (clickhouse-logger).

Ships access-log entries to ClickHouse over its HTTP interface. Each request builds one log entry (the shared build_entry shape, or a custom log_format) that is handed to a fire-and-forget BatchSink; a background task POSTs batches as an INSERT INTO <logtable> FORMAT JSONEachRow statement whose body is the newline-delimited JSON entries.

Ports APISIX’s clickhouse-logger: the SQL prefix, the JSONEachRow payload, and the X-ClickHouse-User / X-ClickHouse-Key / X-ClickHouse-Database auth headers all mirror send_http_data in the Lua plugin.

§Deviations from APISIX

  • APISIX joins multiple encoded entries with a single space; featherbit joins with a newline. ClickHouse’s JSONEachRow format accepts either as a row separator, so the ingested rows are identical.

Structs§

ClickhouseFlusher 🔒
Delivers batches to a ClickHouse HTTP endpoint.
ClickhouseLoggerPlugin
Node that batches access-log entries and inserts them into ClickHouse.

Functions§

build_insert_body 🔒
Builds the request body: an INSERT INTO <logtable> FORMAT JSONEachRow statement followed by the newline-joined JSON entries (APISIX send_http_data). Pure and network-free for testing.
collect_endpoints 🔒
required_string 🔒