diff options
author | Gary Moon <garymoon@users.noreply.github.com> | 2023-04-13 09:14:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-13 21:14:06 +0800 |
commit | 29194a9dd6f5d8a98096a4a01c33d9be89616ed7 (patch) | |
tree | 7a86b688677d61be3f0cec004d0078096193fd7a /custom | |
parent | 2b749af50508a28c7088e7d76132c27f96a45789 (diff) | |
download | gitea-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 'custom')
-rw-r--r-- | custom/conf/app.example.ini | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index 88297fe0d9..f9f207522c 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -603,7 +603,7 @@ ROUTER = console ;ACCESS = file ;; ;; Sets the template used to create the access log. -;ACCESS_LOG_TEMPLATE = {{.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 = {{.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}}" ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; |