aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content/doc/administration/config-cheat-sheet.zh-cn.md
diff options
context:
space:
mode:
authorGary Moon <garymoon@users.noreply.github.com>2023-04-13 09:14:06 -0400
committerGitHub <noreply@github.com>2023-04-13 21:14:06 +0800
commit29194a9dd6f5d8a98096a4a01c33d9be89616ed7 (patch)
tree7a86b688677d61be3f0cec004d0078096193fd7a /docs/content/doc/administration/config-cheat-sheet.zh-cn.md
parent2b749af50508a28c7088e7d76132c27f96a45789 (diff)
downloadgitea-29194a9dd6f5d8a98096a4a01c33d9be89616ed7.tar.gz
gitea-29194a9dd6f5d8a98096a4a01c33d9be89616ed7.zip
Correct the access log format (#24085)
The default access log format has been unnecessarily escaped, leading to spurious backslashes appearing in log lines. Additionally, the `RemoteAddr` field includes the port, which breaks most log parsers attempting to process it. I've added a call to `net.SplitHostPort()` attempting to isolate the address alone, with a fallback to the original address if it errs. Signed-off-by: Gary Moon <gary@garymoon.net>
Diffstat (limited to 'docs/content/doc/administration/config-cheat-sheet.zh-cn.md')
-rw-r--r--docs/content/doc/administration/config-cheat-sheet.zh-cn.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/docs/content/doc/administration/config-cheat-sheet.zh-cn.md b/docs/content/doc/administration/config-cheat-sheet.zh-cn.md
index 043cc42e53..83e212f32b 100644
--- a/docs/content/doc/administration/config-cheat-sheet.zh-cn.md
+++ b/docs/content/doc/administration/config-cheat-sheet.zh-cn.md
@@ -265,7 +265,7 @@ test01.xls: application/vnd.ms-excel; charset=binary
- `LEVEL`: 日志级别,默认为 `Trace`。
- `DISABLE_ROUTER_LOG`: 关闭日志中的路由日志。
- `ENABLE_ACCESS_LOG`: 是否开启 Access Log, 默认为 false。
-- `ACCESS_LOG_TEMPLATE`: `access.log` 输出内容的模板,默认模板:**`{{.Ctx.RemoteAddr}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.URL.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}\" \"{{.Ctx.Req.UserAgent}}"`**
+- `ACCESS_LOG_TEMPLATE`: `access.log` 输出内容的模板,默认模板:**`{{.Ctx.RemoteHost}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.URL.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}" "{{.Ctx.Req.UserAgent}}"`**
模板支持以下参数:
- `Ctx`: 请求上下文。
- `Identity`: 登录用户名,默认: “`-`”。