You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by mo...@apache.org on 2023/12/01 09:35:53 UTC

(apisix) branch master updated: docs(rocketmq-logger): update the document (#10578)

This is an automated email from the ASF dual-hosted git repository.

monkeydluffy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new cef48970c docs(rocketmq-logger): update the document (#10578)
cef48970c is described below

commit cef48970c8a3755d866ff0993ecbe17ac0c4a485
Author: Vacant <va...@gmail.com>
AuthorDate: Fri Dec 1 17:35:48 2023 +0800

    docs(rocketmq-logger): update the document (#10578)
---
 docs/en/latest/plugins/rocketmq-logger.md | 42 +++++++++++++++----------------
 docs/zh/latest/plugins/rocketmq-logger.md | 10 +++++---
 2 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/docs/en/latest/plugins/rocketmq-logger.md b/docs/en/latest/plugins/rocketmq-logger.md
index be3245aee..f75b45589 100644
--- a/docs/en/latest/plugins/rocketmq-logger.md
+++ b/docs/en/latest/plugins/rocketmq-logger.md
@@ -34,23 +34,23 @@ It might take some time to receive the log data. It will be automatically sent a
 
 ## Attributes
 
-| Name                   | Type    | Required | Default           | Valid values          | Description                                                                                                                                                                                                               |
-|------------------------|---------|----------|-------------------|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| nameserver_list        | object  | True     |                   |                       | List of RocketMQ nameservers.                                                                                                                                                                                             |
-| topic                  | string  | True     |                   |                       | Target topic to push the data to.                                                                                                                                                                                         |
-| key                    | string  | False    |                   |                       | Key of the messages.                                                                                                                                                                                                      |
-| tag                    | string  | False    |                   |                       | Tag of the messages.                                                                                                                                                                                                      |
-| log_format | object | False    | {"host": "$host", "@timestamp": "$time_iso8601", "client_ip": "$remote_addr"} |            | Log format declared as key value pairs in JSON format. Values only support strings. [APISIX](../apisix-variable.md) or [Nginx](http://nginx.org/en/docs/varindex.html) variables can be used by prefixing the string with `$`. |
-| timeout                | integer | False    | 3                 | [1,...]               | Timeout for the upstream to send data.                                                                                                                                                                                    |
-| use_tls                | boolean | False    | false             |                       | When set to `true`, uses TLS.                                                                                                                                                                                             |
-| access_key             | string  | False    | ""                |                       | Access key for ACL. Setting to an empty string will disable the ACL.                                                                                                                                                      |
-| secret_key             | string  | False    | ""                |                       | secret key for ACL.                                                                                                                                                                                                       |
-| name                   | string  | False    | "rocketmq logger" |                       | Unique identifier for the batch processor.                                                                                                                                                                                |
-| meta_format            | enum    | False    | "default"         | ["default","origin"] | Format to collect the request information. Setting to `default` collects the information in JSON format and `origin` collects the information with the original HTTP request. See [examples](#meta_format-example) below. |
-| include_req_body       | boolean | False    | false             | [false, true]         | When set to `true` includes the request body in the log. If the request body is too big to be kept in the memory, it can't be logged due to Nginx's limitations.                                                          |
-| include_req_body_expr  | array   | False    |                   |                       | Filter for when the `include_req_body` attribute is set to `true`. Request body is only logged when the expression set here evaluates to `true`. See [lua-resty-expr](https://github.com/api7/lua-resty-expr) for more.   |
-| include_resp_body      | boolean | False    | false             | [false, true]         | When set to `true` includes the response body in the log.                                                                                                                                                                 |
-| include_resp_body_expr | array   | False    |                   |                       | Filter for when the `include_resp_body` attribute is set to `true`. Response body is only logged when the expression set here evaluates to `true`. See [lua-resty-expr](https://github.com/api7/lua-resty-expr) for more. |
+| Name                   | Type    | Required | Default                                                                       | Valid values         | Description                                                                                                                                                                                                                    |
+|------------------------|---------|----------|-------------------------------------------------------------------------------|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| nameserver_list        | object  | True     |                                                                               |                      | List of RocketMQ nameservers.                                                                                                                                                                                                  |
+| topic                  | string  | True     |                                                                               |                      | Target topic to push the data to.                                                                                                                                                                                              |
+| key                    | string  | False    |                                                                               |                      | Key of the messages.                                                                                                                                                                                                           |
+| tag                    | string  | False    |                                                                               |                      | Tag of the messages.                                                                                                                                                                                                           |
+| log_format             | object  | False    | {"host": "$host", "@timestamp": "$time_iso8601", "client_ip": "$remote_addr"} |                      | Log format declared as key value pairs in JSON format. Values only support strings. [APISIX](../apisix-variable.md) or [Nginx](http://nginx.org/en/docs/varindex.html) variables can be used by prefixing the string with `$`. |
+| timeout                | integer | False    | 3                                                                             | [1,...]              | Timeout for the upstream to send data.                                                                                                                                                                                         |
+| use_tls                | boolean | False    | false                                                                         |                      | When set to `true`, uses TLS.                                                                                                                                                                                                  |
+| access_key             | string  | False    | ""                                                                            |                      | Access key for ACL. Setting to an empty string will disable the ACL.                                                                                                                                                           |
+| secret_key             | string  | False    | ""                                                                            |                      | secret key for ACL.                                                                                                                                                                                                            |
+| name                   | string  | False    | "rocketmq logger"                                                             |                      | Unique identifier for the batch processor.                                                                                                                                                                                     |
+| meta_format            | enum    | False    | "default"                                                                     | ["default","origin"] | Format to collect the request information. Setting to `default` collects the information in JSON format and `origin` collects the information with the original HTTP request. See [examples](#meta_format-example) below.      |
+| include_req_body       | boolean | False    | false                                                                         | [false, true]        | When set to `true` includes the request body in the log. If the request body is too big to be kept in the memory, it can't be logged due to Nginx's limitations.                                                               |
+| include_req_body_expr  | array   | False    |                                                                               |                      | Filter for when the `include_req_body` attribute is set to `true`. Request body is only logged when the expression set here evaluates to `true`. See [lua-resty-expr](https://github.com/api7/lua-resty-expr) for more.        |
+| include_resp_body      | boolean | False    | false                                                                         | [false, true]        | When set to `true` includes the response body in the log.                                                                                                                                                                      |
+| include_resp_body_expr | array   | False    |                                                                               |                      | Filter for when the `include_resp_body` attribute is set to `true`. Response body is only logged when the expression set here evaluates to `true`. See [lua-resty-expr](https://github.com/api7/lua-resty-expr) for more.      |
 
 NOTE: `encrypt_fields = {"secret_key"}` is also defined in the schema, which means that the field will be stored encrypted in etcd. See [encrypted storage fields](../plugin-develop.md#encrypted-storage-fields).
 
@@ -124,9 +124,9 @@ If the process is successful, it will return `true` and if it fails, returns `ni
 
 You can also set the format of the logs by configuring the Plugin metadata. The following configurations are available:
 
-| Name       | Type   | Required | Default                                                                       | Description                                                                                                                                                                                                                                             |
-| ---------- | ------ | -------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| log_format | object | False | {"host": "$host", "@timestamp": "$time_iso8601", "client_ip": "$remote_addr"} | Log format declared as key value pairs in JSON format. Values only support strings. [APISIX](../apisix-variable.md) or [Nginx](http://nginx.org/en/docs/varindex.html) variables can be used by prefixing the string with `$`. |
+| Name       | Type   | Required | Default                                                                       | Description                                                                                                                                                                                                                    |
+|------------|--------|----------|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| log_format | object | False    | {"host": "$host", "@timestamp": "$time_iso8601", "client_ip": "$remote_addr"} | Log format declared as key value pairs in JSON format. Values only support strings. [APISIX](../apisix-variable.md) or [Nginx](http://nginx.org/en/docs/varindex.html) variables can be used by prefixing the string with `$`. |
 
 :::info IMPORTANT
 
@@ -198,7 +198,7 @@ curl -i http://127.0.0.1:9080/hello
 
 ## Delete Plugin
 
-To remove the `rocketmq-logger` Plugin, you can delete the corresponding JSON configuration from the Plugin configuration. APISIX will automatically reload and you do not have to restart for this to take effect.
+To remove the `rocketmq-logger` Plugin, you can delete the corresponding JSON configuration from the Plugin configuration. APISIX will automatically reload, and you do not have to restart for this to take effect.
 
 ```shell
 curl http://127.0.0.1:9180/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
diff --git a/docs/zh/latest/plugins/rocketmq-logger.md b/docs/zh/latest/plugins/rocketmq-logger.md
index afdd40e52..454a4292a 100644
--- a/docs/zh/latest/plugins/rocketmq-logger.md
+++ b/docs/zh/latest/plugins/rocketmq-logger.md
@@ -39,7 +39,7 @@ description: API 网关 Apache APISIX 的 rocketmq-logger 插件用于将日志
 | topic                  | string  | 是     |                   |                       | 要推送的 topic 名称。                             |
 | key                    | string  | 否     |                   |                       | 发送消息的 keys。                                 |
 | tag                    | string  | 否     |                   |                       | 发送消息的 tags。                                 |
-| log_format             | object  | 否   |          |         | 以 JSON 格式的键值对来声明日志格式。对于值部分,仅支持字符串。如果是以 `$` 开头,则表明是要获取 [APISIX 变量](../apisix-variable.md) 或 [NGINX 内置变量](http://nginx.org/en/docs/varindex.html)。 |
+| log_format             | object  | 否     |                   |                       | 以 JSON 格式的键值对来声明日志格式。对于值部分,仅支持字符串。如果是以 `$` 开头,则表明是要获取 [APISIX 变量](../apisix-variable.md) 或 [NGINX 内置变量](http://nginx.org/en/docs/varindex.html)。 |
 | timeout                | integer | 否     | 3                 | [1,...]               | 发送数据的超时时间。                              |
 | use_tls                | boolean | 否     | false             |                       | 当设置为 `true` 时,开启 TLS 加密。               |
 | access_key             | string  | 否     | ""                |                       | ACL 认证的 Access key,空字符串表示不开启 ACL。    |
@@ -121,9 +121,9 @@ description: API 网关 Apache APISIX 的 rocketmq-logger 插件用于将日志
 
 ## 插件元数据设置
 
-| 名称             | 类型    | 必选项 | 默认值        |  描述                                             |
-| ---------------- | ------- | ------ | ------------- |------------------------------------------------ |
-| 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 | 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)。 |
 
 :::note 注意
 
@@ -164,6 +164,8 @@ curl http://127.0.0.1:9180/apisix/admin/routes/1 \
        "rocketmq-logger": {
            "nameserver_list" : [ "127.0.0.1:9876" ],
            "topic" : "test2",
+           "batch_max_size": 1,
+           "name": "rocketmq logger"
        }
     },
     "upstream": {