You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/08/15 14:29:31 UTC

[GitHub] [apisix] hf400159 opened a new pull request, #7688: docs: refactor loggers plugin doc

hf400159 opened a new pull request, #7688:
URL: https://github.com/apache/apisix/pull/7688

   ### Description
   
   <!-- Please include a summary of the change and which issue is fixed. -->
   <!-- Please also include relevant motivation and context. -->
   
   Fixes # (issue)
   
   ### Checklist
   
   - [ ] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7688: docs: refactor loggers plugin doc(1)

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7688:
URL: https://github.com/apache/apisix/pull/7688#discussion_r952053971


##########
docs/zh/latest/plugins/clickhouse-logger.md:
##########
@@ -23,72 +29,35 @@ title: clickhouse-logger
 
 ## 描述
 
-`clickhouse-logger` 是一个插件,可将 Log 数据请求推送到 clickhouse 服务器。
+`clickhouse-logger` 插件可用于将日志数据推送到 [ClickHouse](https://github.com/ClickHouse/ClickHouse) 数据库中。
 
 ## 属性
 
-| 名称             | 类型    | 必选项 | 默认值        | 有效值  | 描述                                                 |
-| ---------------- | ------- | ------ | ------------- | ------- | ------------------------------------------------  |
-| endpoint_addr    | 废弃    | 必须   |               |         | 推荐使用 `endpoint_addrs` 代替。`clickhouse` 服务器的 endpoints。|
-| endpoint_addrs   | array    | 必须   |               |         | `clickhouse` 服务器的 endpoints。|
-| database         | string  | 必须   |               |         | 使用的数据库。                                      |
-| logtable         | string  | 必须   |               |         | 写入的表名 。                                       |
-| user             | string  | 必须   |               |         | clickhouse 的用户。                                |
-| password         | string  | 必须   |               |         | clickhouse 的密码 。                               |
-| timeout          | integer | 可选   | 3             | [1,...] | 发送请求后保持连接活动的时间。                       |
-| name             | string  | 可选   | "clickhouse logger" |         | 标识 logger 的唯一标识符。                    |
-| ssl_verify       | boolean | 可选   | true          | [true,false] | 验证证书。                                    |
+| 名称             | 类型    | 必选项  | 默认值              | 有效值       | 描述                                                     |
+| ---------------- | ------- | ------ | ------------------- | ----------- | -------------------------------------------------------- |
+| endpoint_addr    | 废弃    | 是     |                     |              | ClickHouse 的 `endpoints`。请使用 `endpoint_addrs` 代替。 |
+| endpoint_addrs   | array   | 是     |                     |              | ClickHouse 的 `endpoints。`。                            |
+| database         | string  | 是     |                     |              | 使用的数据库。                                            |
+| logtable         | string  | 是     |                     |              | 写入的表名。                                              |
+| user             | string  | 是     |                     |              | ClickHouse 的用户。                                       |
+| password         | string  | 是     |                     |              | ClickHouse 的密码 。                                      |
+| timeout          | integer | 否     | 3                   | [1,...]      | 发送请求后保持连接活动的时间。                             |
+| name             | string  | 否     | "clickhouse logger" |              | 标识 logger 的唯一标识符。                                |
+| ssl_verify       | boolean | 否     | true                | [true,false] | 当设置为 `true` 时,验证证书。                                                |
 
-本插件支持使用批处理器来聚合并批量处理条目(日志/数据)。这样可以避免插件频繁地提交数据,默认设置情况下批处理器会每 `5` 秒钟或队列中的数据达到 `1000` 条时提交数据,如需了解或自定义批处理器相关参数设置,请参考 [Batch-Processor](../batch-processor.md#配置) 配置部分。
+该插件支持使用批处理器来聚合并批量处理条目(日志/数据)。这样可以避免插件频繁地提交数据,默认情况下批处理器每 `5` 秒钟或队列中的数据达到 `1000` 条时提交数据,如需了解批处理器相关参数设置,请参考 [Batch-Processor](../batch-processor.md#配置)。
 
-## 如何开启
+## 配置插件元数据
 
-如果配置多个 endpoints 将随机写入。
-这是有关如何为特定路由启用 `clickhouse-logger` 插件的示例。
-
-```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_addrs": ["http://127.0.0.1:8123"]
-            }
-       },
-      "upstream": {
-           "type": "roundrobin",
-           "nodes": {
-               "127.0.0.1:1980": 1
-           }
-      },
-      "uri": "/hello"
-}'
-```
-
-## 测试插件
-
-> 成功:
-
-```shell
-$ curl -i http://127.0.0.1:9080/hello
-HTTP/1.1 200 OK
-...
-hello, world
-```
-
-## 插件元数据设置
+`clickhouse-logger` 也支持自定义日志格式,与 [http-logger](./http-logger.md) 插件类似。
 
 | 名称             | 类型    | 必选项 | 默认值        | 有效值  | 描述                                             |
 | ---------------- | ------- | ------ | ------------- | ------- | ------------------------------------------------ |
-| log_format       | object  | 可选   | {"host": "$host", "@timestamp": "$time_iso8601", "client_ip": "$remote_addr"} |         | 以 JSON 格式的键值对来声明日志格式。对于值部分,仅支持字符串。如果是以 `$` 开头,则表明是要获取 [APISIX 变量](../../../en/latest/apisix-variable.md)或 [Nginx 内置变量](http://nginx.org/en/docs/varindex.html)。请注意,**该设置是全局生效的**,因此在指定 log_format 后,将对所有绑定 clickhouse-logger 的 Route 或 Service 生效。 |
-
-### 设置日志格式示例
+| log_format       | object  | 否   | {"host": "$host", "@timestamp": "$time_iso8601", "client_ip": "$remote_addr"} |         | 以 JSON 格式的键值对来声明日志格式。对于值部分,仅支持字符串。如果是以 `$` 开头,则表明是要获取 [APISIX](../apisix-variable.md) 或 [NGINX](http://nginx.org/en/docs/varindex.html) 变量。该配置全局生效。如果你指定了 `log_format`,该配置就会对所有绑定 `skywalking-logger` 的路由或服务生效。|

Review Comment:
   ```suggestion
   | log_format       | object  | 否   | {"host": "$host", "@timestamp": "$time_iso8601", "client_ip": "$remote_addr"} |         | 以 JSON 格式的键值对来声明日志格式。对于值部分,仅支持字符串。如果是以 `$` 开头,则表明是要获取 [APISIX](../apisix-variable.md) 或 [NGINX](http://nginx.org/en/docs/varindex.html) 变量。该配置全局生效。如果你指定了 `log_format`,该配置就会对所有绑定 `clickhouse-logger` 的路由或服务生效。|
   ```



-- 
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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] SylviaBABY merged pull request #7688: docs: refactor loggers plugin doc(1)

Posted by GitBox <gi...@apache.org>.
SylviaBABY merged PR #7688:
URL: https://github.com/apache/apisix/pull/7688


-- 
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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7688: docs: refactor loggers plugin doc(1)

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7688:
URL: https://github.com/apache/apisix/pull/7688#discussion_r951034051


##########
docs/zh/latest/plugins/clickhouse-logger.md:
##########
@@ -23,72 +29,35 @@ title: clickhouse-logger
 
 ## 描述
 
-`clickhouse-logger` 是一个插件,可将 Log 数据请求推送到 clickhouse 服务器。
+`clickhouse-logger` 插件可用于将日志数据推送到 [ClickHouse](https://github.com/ClickHouse/ClickHouse) 数据库中。
 
 ## 属性
 
-| 名称             | 类型    | 必选项 | 默认值        | 有效值  | 描述                                                 |
-| ---------------- | ------- | ------ | ------------- | ------- | ------------------------------------------------  |
-| endpoint_addr    | 废弃    | 必须   |               |         | 推荐使用 `endpoint_addrs` 代替。`clickhouse` 服务器的 endpoints。|
-| endpoint_addrs   | array    | 必须   |               |         | `clickhouse` 服务器的 endpoints。|
-| database         | string  | 必须   |               |         | 使用的数据库。                                      |
-| logtable         | string  | 必须   |               |         | 写入的表名 。                                       |
-| user             | string  | 必须   |               |         | clickhouse 的用户。                                |
-| password         | string  | 必须   |               |         | clickhouse 的密码 。                               |
-| timeout          | integer | 可选   | 3             | [1,...] | 发送请求后保持连接活动的时间。                       |
-| name             | string  | 可选   | "clickhouse logger" |         | 标识 logger 的唯一标识符。                    |
-| ssl_verify       | boolean | 可选   | true          | [true,false] | 验证证书。                                    |
+| 名称             | 类型    | 必选项  | 默认值              | 有效值       | 描述                                                     |
+| ---------------- | ------- | ------ | ------------------- | ----------- | -------------------------------------------------------- |
+| endpoint_addr    | 废弃    | 是     |                     |              | 请使用 `endpoint_addrs` 代替。ClickHouse 的 `endpoints`。 |

Review Comment:
   ```suggestion
   | endpoint_addr    | 废弃    | 是     |                     |              | 请使用 `endpoint_addrs` 代替 ClickHouse 的 `endpoints`。 |
   ```



##########
docs/zh/latest/plugins/clickhouse-logger.md:
##########
@@ -23,72 +29,35 @@ title: clickhouse-logger
 
 ## 描述
 
-`clickhouse-logger` 是一个插件,可将 Log 数据请求推送到 clickhouse 服务器。
+`clickhouse-logger` 插件可用于将日志数据推送到 [ClickHouse](https://github.com/ClickHouse/ClickHouse) 数据库中。
 
 ## 属性
 
-| 名称             | 类型    | 必选项 | 默认值        | 有效值  | 描述                                                 |
-| ---------------- | ------- | ------ | ------------- | ------- | ------------------------------------------------  |
-| endpoint_addr    | 废弃    | 必须   |               |         | 推荐使用 `endpoint_addrs` 代替。`clickhouse` 服务器的 endpoints。|
-| endpoint_addrs   | array    | 必须   |               |         | `clickhouse` 服务器的 endpoints。|
-| database         | string  | 必须   |               |         | 使用的数据库。                                      |
-| logtable         | string  | 必须   |               |         | 写入的表名 。                                       |
-| user             | string  | 必须   |               |         | clickhouse 的用户。                                |
-| password         | string  | 必须   |               |         | clickhouse 的密码 。                               |
-| timeout          | integer | 可选   | 3             | [1,...] | 发送请求后保持连接活动的时间。                       |
-| name             | string  | 可选   | "clickhouse logger" |         | 标识 logger 的唯一标识符。                    |
-| ssl_verify       | boolean | 可选   | true          | [true,false] | 验证证书。                                    |
+| 名称             | 类型    | 必选项  | 默认值              | 有效值       | 描述                                                     |
+| ---------------- | ------- | ------ | ------------------- | ----------- | -------------------------------------------------------- |
+| endpoint_addr    | 废弃    | 是     |                     |              | 请使用 `endpoint_addrs` 代替。ClickHouse 的 `endpoints`。 |
+| endpoint_addrs   | array   | 是     |                     |              | ClickHouse 的 endpoints。                                |
+| database         | string  | 是     |                     |              | 使用的数据库。                                            |
+| logtable         | string  | 是     |                     |              | 写入的表名。                                              |
+| user             | string  | 是     |                     |              | ClickHouse 的用户。                                       |
+| password         | string  | 是     |                     |              | ClickHouse 的密码 。                                      |
+| timeout          | integer | 否     | 3                   | [1,...]      | 发送请求后保持连接活动的时间。                             |
+| name             | string  | 否     | "clickhouse logger" |              | 标识 logger 的唯一标识符。                                |
+| ssl_verify       | boolean | 否     | true                | [true,false] | 当设置为 `true` 时,验证证书。                                                |
 
-本插件支持使用批处理器来聚合并批量处理条目(日志/数据)。这样可以避免插件频繁地提交数据,默认设置情况下批处理器会每 `5` 秒钟或队列中的数据达到 `1000` 条时提交数据,如需了解或自定义批处理器相关参数设置,请参考 [Batch-Processor](../batch-processor.md#配置) 配置部分。
+该插件支持使用批处理器来聚合并批量处理条目(日志/数据)。这样可以避免插件频繁地提交数据,默认情况下批处理器每 `5` 秒钟或队列中的数据达到 `1000` 条时提交数据,如需了解批处理器相关参数设置,请参考 [Batch-Processor](../batch-processor.md#配置)。
 
-## 如何开启
+## 配置插件元数据
 
-如果配置多个 endpoints 将随机写入。
-这是有关如何为特定路由启用 `clickhouse-logger` 插件的示例。
-
-```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_addrs": ["http://127.0.0.1:8123"]
-            }
-       },
-      "upstream": {
-           "type": "roundrobin",
-           "nodes": {
-               "127.0.0.1:1980": 1
-           }
-      },
-      "uri": "/hello"
-}'
-```
-
-## 测试插件
-
-> 成功:
-
-```shell
-$ curl -i http://127.0.0.1:9080/hello
-HTTP/1.1 200 OK
-...
-hello, world
-```
-
-## 插件元数据设置
+`skywalking-logger` 也支持自定义日志格式,与 [http-logger](./http-logger.md) 插件类似。

Review Comment:
   clickhouse-logger?



##########
docs/zh/latest/plugins/error-log-logger.md:
##########
@@ -114,16 +105,15 @@ curl http://127.0.0.1:9080/apisix/admin/plugin_metadata/error-log-logger -H 'X-A
 }'
 ```
 
-## 如何设置接收日志的 clickhouse 数据库
+### 如何设置接收日志的 ClickHouse 数据库

Review Comment:
   ```suggestion
   ### 配置 ClickHouse 数据库
   ```



##########
docs/zh/latest/plugins/log-rotate.md:
##########
@@ -96,6 +95,17 @@ plugin_attr:
         enable_compression: false    # enable log file compression(gzip) or not, default false
 ```
 
-#### 禁用插件
+配置完成,你需要重新加载 APISIX。
 
-在 `conf/config.yaml` 中删除插件 `log-rotate` 即可。
+## 禁用插件
+
+当你不在需要该插件是,只需要在 `./conf/config.yaml` 中删除或注释该插件即可。

Review Comment:
   ```suggestion
   当你不再需要该插件时,只需要在 `./conf/config.yaml` 中删除或注释该插件即可。
   ```



##########
docs/zh/latest/plugins/clickhouse-logger.md:
##########
@@ -111,20 +80,61 @@ CREATE TABLE default.test (
 ) ENGINE = MergeTree()
 ```
 
-在 clickhouse 上执行`select * from default.test;`,将得到类似下面的数据:
+在 ClickHouse 中执行`select * from default.test;`,将得到类似下面的数据:
 
 ```
 ┌─host──────┬─client_ip─┬─route_id─┬─@timestamp────────────────┐
 │ 127.0.0.1 │ 127.0.0.1 │ 1        │ 2022-01-17T10:03:10+08:00 │
 └───────────┴───────────┴──────────┴───────────────────────────┘
 ```
 
+## 启用插件
+
+你可以通过以下命令在指定路由中启用该插件:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '

Review Comment:
   ```suggestion
   curl http://127.0.0.1:9080/apisix/admin/routes/1  \
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   ```



##########
docs/zh/latest/plugins/error-log-logger.md:
##########
@@ -134,3 +124,16 @@ curl http://127.0.0.1:9080/apisix/admin/plugin_metadata/error-log-logger -H 'X-A
   }
 }'
 ```
+
+## 禁用插件
+
+当你不在需要该插件是,只需要在 `./conf/config.yaml` 中删除或注释该插件即可。

Review Comment:
   ```suggestion
   当你不再需要该插件时,只需要在 `./conf/config.yaml` 中删除或注释该插件即可。
   ```



##########
docs/zh/latest/plugins/log-rotate.md:
##########
@@ -1,5 +1,11 @@
 ---
 title: log-rotate
+keywords:
+  - APISIX
+  - API 网关
+  - Plugin
+  - 日志切分
+description: 云原生 API 网关 Apache APISIX log-rotate 插件用于定期在日志目录下的访问日志和错误日志的定期切分。

Review Comment:
   ```suggestion
   description: 云原生 API 网关 Apache APISIX log-rotate 插件用于将日志目录下的访问日志和错误日志进行定期切分。
   ```



##########
docs/zh/latest/plugins/udp-logger.md:
##########
@@ -1,5 +1,11 @@
 ---
 title: udp-logger
+keywords:
+  - APISIX
+  - API 网关
+  - Plugin
+  - UDP Logger
+description: 本文介绍了 API 网关 Apache APISIX 如何使用 udp-logger 插件将日志数据发送到 TCP 服务器。

Review Comment:
   ```suggestion
   description: 本文介绍了 API 网关 Apache APISIX 如何使用 udp-logger 插件将日志数据发送到 UDP 服务器。
   ```



-- 
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-unsubscribe@apisix.apache.org

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