This is an automated email from the ASF dual-hosted git repository.
sylviasu 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 5d6a0e8aa docs: add file-logger plugin desc (#7868)
5d6a0e8aa is described below
commit 5d6a0e8aa63b7a0b232767339d6c48675c43f0c8
Author: Fei Han <[email protected]>
AuthorDate: Thu Sep 15 09:39:17 2022 +0800
docs: add file-logger plugin desc (#7868)
* docs: add file-logger plugin desc
* update decs
---
docs/en/latest/plugins/file-logger.md | 10 ++++++++++
docs/zh/latest/plugins/file-logger.md | 20 +++++++++++++++++++-
docs/zh/latest/plugins/kafka-logger.md | 2 +-
3 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/docs/en/latest/plugins/file-logger.md
b/docs/en/latest/plugins/file-logger.md
index 634f7e178..39155c472 100644
--- a/docs/en/latest/plugins/file-logger.md
+++ b/docs/en/latest/plugins/file-logger.md
@@ -31,6 +31,16 @@ description: This document contains information about the
Apache APISIX file-log
The `file-logger` Plugin is used to push log streams to a specific location.
+:::tip
+
+- `file-logger` plugin can count request and response data for individual
routes locally, which is useful for [debugging](../debug-mode.md).
+- `file-logger` plugin can get [APISIX variables](../apisix-variable.md) and
[NGINX variables](http://nginx.org/en/docs/varindex.html), while `access.log`
can only use NGINX variables.
+- `file-logger` plugin support hot-loaded so that we can change its
configuration at any time with immediate effect.
+- `file-logger` plugin saves every data in JSON format.
+- The user can modify the functions executed by the `file-logger` during the
`log phase` to collect the information they want.
+
+:::
+
## Attributes
| Name | Type | Required | Description |
diff --git a/docs/zh/latest/plugins/file-logger.md
b/docs/zh/latest/plugins/file-logger.md
index ce464f66e..449ae9b36 100644
--- a/docs/zh/latest/plugins/file-logger.md
+++ b/docs/zh/latest/plugins/file-logger.md
@@ -31,6 +31,18 @@ description: API 网关 Apache APISIX file-logger 插件可用于将日志数据
`file-logger` 插件可用于将日志数据存储到指定位置。
+:::tip 提示
+
+`file-logger` 插件特点如下:
+
+- 可将指定路由的日志发送到指定位置,方便你在本地统计各个路由的请求和响应数据。在使用 [debug
mode](../../../en/latest/debug-mode.md) 时,你可以很轻松地将出现问题的路由的日志输出到指定文件中,从而更方便地排查问题。
+- 可以获取 [APISIX 变量](../../../en/latest/apisix-variable.md)和 [NGINX
变量](http://nginx.org/en/docs/varindex.html),而 `access.log` 仅能使用 NGINX 变量。
+- 支持热加载,你可以在路由中随时更改其配置并立即生效。而修改 `access.log` 相关配置,则需要重新加载 APISIX。
+- 支持以 JSON 格式保存日志数据。
+- 可以在 `log phase` 阶段修改 `file-logger` 执行的函数来收集你所需要的信息。
+
+:::
+
## 属性
| 名称 | 类型 | 必选项 | 描述
|
@@ -41,7 +53,13 @@ description: API 网关 Apache APISIX file-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` 后,将对所有绑定 `file-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)。 |
+
+:::note 注意
+
+该设置全局生效。如果指定了 `log_format`,则所有绑定 `file-logger` 的路由或服务都将使用该日志格式。
+
+:::
以下示例展示了如何通过 Admin API 配置插件元数据:
diff --git a/docs/zh/latest/plugins/kafka-logger.md
b/docs/zh/latest/plugins/kafka-logger.md
index 999b23286..ba8bf493d 100644
--- a/docs/zh/latest/plugins/kafka-logger.md
+++ b/docs/zh/latest/plugins/kafka-logger.md
@@ -42,7 +42,7 @@ description: API 网关 Apache APISIX 的 kafka-logger 插件用于将日志作
| key | string | 否 | |
| 用于消息分区而分配的密钥。 |
| timeout | integer | 否 | 3 | [1,...]
| 发送数据的超时时间。 |
| name | string | 否 | "kafka logger" |
| batch processor 的唯一标识。 |
-| meta_format | enum | 否 | "default" |
["default","origin"] | `default`:获取请求信息以默认的 JSON 编码方式。`origin`:获取请求信息以 HTTP
原始请求方式。更多信息,请参考 [meta_format](#meta_format-参考示例)。|
+| meta_format | enum | 否 | "default" |
["default","origin"] | `default`:获取请求信息以默认的 JSON 编码方式。`origin`:获取请求信息以 HTTP
原始请求方式。更多信息,请参考 [meta_format](#meta_format-示例)。|
| include_req_body | boolean | 否 | false | [false, true]
| 当设置为 `true` 时,包含请求体。**注意**:如果请求体无法完全存放在内存中,由于 NGINX 的限制,APISIX 无法将它记录下来。|
| include_req_body_expr | array | 否 | |
| 当 `include_req_body` 属性设置为 `true` 时进行过滤。只有当此处设置的表达式计算结果为 `true`
时,才会记录请求体。更多信息,请参考 [lua-resty-expr](https://github.com/api7/lua-resty-expr)。 |
| include_resp_body | boolean | 否 | false | [false, true]
| 当设置为 `true` 时,包含响应体。 |