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/03 08:17:53 UTC

[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7586: docs: refactor skywalking-logger plugin docs

SylviaBABY commented on code in PR #7586:
URL: https://github.com/apache/apisix/pull/7586#discussion_r936373258


##########
docs/zh/latest/plugins/skywalking-logger.md:
##########
@@ -23,29 +29,67 @@ title: skywalking-logger
 
 ## 描述
 
-`skywalking-logger` 是一个可将 Access Log 数据通过 `HTTP` 推送到 `SkyWalking OAP` 服务器的插件。如果上下文中存在 `tracing context`,插件会自动建立 `trace` 与日志的关联,这依赖于 [SkyWalking Cross Process Propagation Headers Protocol](https://skywalking.apache.org/docs/main/latest/en/protocols/skywalking-cross-process-propagation-headers-protocol-v3/)的支持。
+`skywalking-logger` 插件可用于将 APISIX 的访问日志数据推送到 SkyWalking OAP 服务器。
 
-本插件提供将 Access Log 数据作为 JSON 对象发送到 `SkyWalking OAP` 服务器的功能。
+如果上下文中存在 `tracing context`,插件会自动建立 `trace` 与日志的关联,该功能依赖于 [SkyWalking Cross Process Propagation Headers Protocol](https://skywalking.apache.org/docs/main/latest/en/protocols/skywalking-cross-process-propagation-headers-protocol-v3/)。
+
+该插件也提供了将访问日志作为 JSON 对象发送到 SkyWalking OAP 服务器的能力。
 
 ## 属性
 
+| 名称                    | 类型    | 必选项 | 默认值                | 有效值        | 描述                                                               |
+| ---------------------- | ------- | ------ | -------------------- | ------------- | ---------------------------------------------------------------- |
+| endpoint_addr          | string  | 是     |                      |               | SkyWalking OAP 服务器的 URI。                                      |
+| service_name           | string  | 否     |"APISIX"              |               | SkyWalking 服务名称。                                              |
+| service_instance_name  | string  | 否     |"APISIX Instance Name"|               | SkyWalking 服务的实例名称。当设置为 `$hostname`会直接获取本地主机名。 |
+| timeout                | integer | 否     | 3                    | [1,...]       | 发送请求后保持连接活动的时间。                                       |
+| name                   | string  | 否     | "skywalking logger"  |               | 标识 logger 的唯一标识符。                                         |
+| include_req_body       | boolean | 否     | false                | [false, true] | 当设置为 `true` 时,将请求正文包含在日志中。                         |
+
+该插件支持使用批处理器来聚合并批量处理条目(日志/数据)。这样可以避免插件频繁地提交数据,默认设置情况下批处理器会每 `5` 秒钟或队列中的数据达到 `1000` 条时提交数据,如需了解或自定义批处理器相关参数设置,请参考 [Batch-Processor](../batch-processor.md#配置)。
+
+## 配置插件元数据
+
+`skywalking-logger` 也支持自定义日志格式,与 [http-logger](./http-logger.md) 插件类似。
+
 | 名称             | 类型    | 必选项 | 默认值        | 有效值  | 描述                                             |
 | ---------------- | ------- | ------ | ------------- | ------- | ------------------------------------------------ |
-| endpoint_addr    | string  | 必须   |               |         | `SkyWalking OAp` 服务器的 URI。                   |
-| service_name   | string  | 可选   |"APISIX"         |         | `SkyWalking` 服务名称。                           |
-| service_instance_name    | string  | 可选   |"APISIX Instance Name"|         | `SkyWalking`服务实例名称,将其设置为`$hostname`以直接获取本地主机名。 |
-| timeout          | integer | 可选   | 3             | [1,...] | 发送请求后保持连接活动的时间。                      |
-| name             | string  | 可选   | "skywalking logger" |         | 标识 logger 的唯一标识符。                   |
-| include_req_body | boolean | 可选   | false         | [false, true] | 是否包括请求 body。false: 表示不包含请求的 body ; true: 表示包含请求的 body 。 |
+| 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) 变量。|

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) 变量。|
   ```



-- 
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