juzhiyuan commented on a change in pull request #5831: URL: https://github.com/apache/apisix/pull/5831#discussion_r776537373
########## File path: docs/zh/latest/plugins/file-logger.md ########## @@ -0,0 +1,121 @@ +--- +title: file-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. +# +--> + +## 目录 + +- [**定义**](#定义) +- [**属性列表**](#属性) +- [**如何开启**](#如何启用) +- [**测试插件**](#测试插件) +- [**插件元数据设置**](#插件元数据设置) +- [**禁用插件**](#禁用插件) + +## 定义 + +`file-logger` 是一个插件,可将 Log 数据流推送到指定位置,例如,可以自定义输入路径:`logs/file.log`。 + +## 属性列表 + +| 名称 | 类型 | 必选项 | 默认值 | 有效值 | 描述 | +| ---------------- | ------- | ------ | ------------- | ------- | ------------------------------------------------ | +| path | string | 必须 | | | 自定义输入文件路径 | +| custom_fields_by_lua | object | 可选 | | | 键值对列表,其中键是日志字段的名称,值为一段 `lua` 代码,其返回值设置或者替换日志字段值 | + +## 如何开启 + +这是有关如何为特定路由启用 `file-logger` 插件的示例。 + +```shell +curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' +{ + "plugins": { + "file-logger": { + "path": "logs/file.log", + "custom_fields_by_lua": {"route_id": "return nil"} + } Review comment: Hi, could we use 2 spaces here? -- 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]
