monkeyDluffy6017 commented on code in PR #9687: URL: https://github.com/apache/apisix/pull/9687#discussion_r1236682152
########## docs/zh/latest/plugins/loki-logger.md: ########## @@ -0,0 +1,165 @@ +--- +title: loki-logger +keywords: + - Apache APISIX + - API 网关 + - Plugin + - Loki-logger + - Grafana Loki +description: 本文件包含关于 Apache APISIX loki-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. +# +--> + +## 描述 + +`loki-logger` 插件用于将日志转发到 [Grafana Loki](https://grafana.com/oss/loki/) 进行分析和存储。 + +当插件启用时,APISIX 将把请求上下文信息序列化为 [JSON 中的日志条目](https://grafana.com/docs/loki/latest/api/#push-log-entries-to-loki) 并提交给批处理队列。当超过最大批处理量时,队列中的数据会被推送到 Grafana Loki。更多细节见 [batch processor](../batch-processor.md)。 + +## 属性 + +| 名称 | 类型 | 必选项 | 默认值 | 描述 | +|--|---|---|---|---| +| endpoint_addrs | array[string] | True | | Loki API 基础 URL,格式如 http://127.0.0.1:3100,支持 HTTPS 和域名。如果配置了多个端点,它们将被随机写入。 | +| endpoint_uri | string | False | /loki/api/v1/push | 如果你使用与 Loki Push API 兼容的日志收集服务,你可以使用这个配置项来定制 API 路径。 | +| tenant_id | string | False | fake | Loki 租户 ID。根据 Loki 的 [多租户文档](https://grafana.com/docs/loki/latest/operations/multi-tenancy/#multi-tenancy),其默认值被设置为单租户下的默认值 `fake`。 | +| log_labels | object | False | {job = "apisix"} | Loki 日志标签。[APISIX 变量](../apisix-variable.md) 和 [Nginx 变量](http://nginx.org/en/docs/varindex.html) 可以通过在字符串前加上 `$` 来使用,包括单独和组合,如 `$host` 或 `$remote_addr:$remote_port`。 | Review Comment: ```suggestion | log_labels | object | False | {job = "apisix"} | Loki 日志标签。[APISIX 变量](../apisix-variable.md) 和 [Nginx 变量](http://nginx.org/en/docs/varindex.html) 可以通过在字符串前加上 `$` 来使用,变量可以单独或者组合使用,如 `$host` 或 `$remote_addr:$remote_port`。 | ``` -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
