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

    1. $ curl -i http://127.0.0.1:9080/hello
    2. HTTP/1.1 200 OK
    3. hello, world
    NameTypeRequirementDefaultValidDescription
    log_formatobjectoptional{“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

    1. CREATE TABLE default.test (
    2. `host` String,
    3. `client_ip` String,
    4. `route_id` String,
    5. `@timestamp` String,
    6. PRIMARY KEY(`@timestamp`)
    7. ) 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.

    1. "uri": "/hello",
    2. "plugins": {},
    3. "upstream": {
    4. "type": "roundrobin",
    5. "nodes": {
    6. "127.0.0.1:1980": 1
    7. }
    8. }