zhendongcmss commented on a change in pull request #6215:
URL: https://github.com/apache/apisix/pull/6215#discussion_r803320498



##########
File path: docs/en/latest/plugins/clickhouse-logger.md
##########
@@ -0,0 +1,148 @@
+---
+title: clickhouse-logger
+---
+
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+## Summary
+
+- [**Name**](#name)
+- [**Attributes**](#attributes)
+- [**How To Enable**](#how-to-enable)
+- [**Test Plugin**](#test-plugin)
+- [**Metadata**](#metadata)
+- [**Disable Plugin**](#disable-plugin)
+
+## Name
+
+`clickhouse-logger` is a plugin which push Log data requests to clickhouse.
+
+## Attributes
+
+| 名称             | 类型    | 必选项  | 默认值         | 有效值  | 描述                      
                       |
+| ---------------- | ------- | ------ | ------------- | ------- | 
------------------------------------------------ |
+| endpoint_addr    | string  | required   |               |         | The 
`clickhouse` endpoint.                  |
+| database         | string  | required   |               |         | The DB 
name to store log.                   |
+| logtable         | string  | required   |               |         | The 
table name.                             |
+| user             | string  | required   |               |         | 
clickhouse user.                             |
+| password         | string  | required   |               |         | 
clickhouse password.                         |
+| timeout          | integer | optional   | 3             | [1,...] | Time to 
keep the connection alive after sending a request.                   |
+| name             | string  | optional   | "clickhouse logger" |         | A 
unique identifier to identity the logger.                             |
+| batch_max_size   | integer | optional   | 100           | [1,...] | Set the 
maximum number of logs sent in each batch. When the number of logs reaches the 
set maximum, all logs will be automatically pushed to the clickhouse.  |
+| max_retry_count  | integer | optional   | 0             | [0,...] | Maximum 
number of retries before removing from the processing pipe line.        |
+| retry_delay      | integer | optional   | 1             | [0,...] | Number 
of seconds the process execution should be delayed if the execution fails.      
       |
+| ssl_verify       | boolean | optional   | true          | [true,false] | 
verify ssl.             |
+
+## How To Enable
+
+The following is an example of how to enable the `clickhouse-logger` for a 
specific route.
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+      "plugins": {
+            "clickhouse-logger": {
+                "user": "default",
+                "password": "a",
+                "database": "default",
+                "logtable": "test",
+                "endpoint_addr": "http://127.0.0.1:8123";
+            }
+       },
+      "upstream": {
+           "type": "roundrobin",
+           "nodes": {
+               "127.0.0.1:1980": 1
+           }
+      },
+      "uri": "/hello"
+}'
+```
+
+## Test Plugin
+
+> success:
+
+```shell
+$ curl -i http://127.0.0.1:9080/hello
+HTTP/1.1 200 OK
+...
+hello, world
+```
+
+## Metadata
+
+| 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` variables or [Nginx 
variable](http://nginx.org/en/docs/varindex.html). |

Review comment:
       ok




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to