clickhouse-logger
Attributes
The plugin supports the use of batch processors to aggregate and process entries(logs/data) in a batch. This avoids frequent data submissions by the plugin, which by default the batch processor submits data every 5
seconds or when the data in the queue reaches 1000
. For information or custom batch processor parameter settings, see Batch-Processor configuration section.
Test Plugin
$ curl -i http://127.0.0.1:9080/hello
HTTP/1.1 200 OK
hello, world
Name | Type | Requirement | Default | Valid | Description |
---|---|---|---|---|---|
log_format | object | optional | {“host”: “$host”, “@timestamp”: “$time_iso8601”, “client_ip”: “$remote_addr”} | Log format declared as key value pair in JSON format. Only string is supported in the value part. If the value starts with , it means to get APISIX variable or . |
create clickhouse log table
CREATE TABLE default.test (
`host` String,
`client_ip` String,
`route_id` String,
`@timestamp` String,
PRIMARY KEY(`@timestamp`)
) ENGINE = MergeTree()
Disable Plugin
Remove the corresponding json configuration in the plugin configuration to disable the clickhouse-logger
. APISIX plugins are hot-reloaded, therefore no need to restart APISIX.
"uri": "/hello",
"plugins": {},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980": 1
}
}