Update gitea access log format

We use the Ctx.Req object's RemoteAddr value as it should include the
IP:port combo according to https://golang.org/pkg/net/http/#Request. The
default template uses Ctx.RemoteAddr which Macaron attempts to parse for
x-forwarded-for values but this has the problem of stripping out any
port info.

The port info is important for us because we are doing layer 4 load
balancing and not http l7 load balancing. That means the ip:port
mappings are necessary to map between haproxy and gitea logs.

Change-Id: Icea0d3d815c9d8dd2afe2b1bae627510c1d76f99
This commit is contained in:
Clark Boylan 2020-06-30 15:48:17 -07:00
parent 96fc5ea416
commit 04efabaacb

View File

@ -52,6 +52,9 @@ PATH = /data/gitea/attachments
ROOT_PATH = /logs
LEVEL = Info
ENABLE_ACCESS_LOG = true
{% raw %}
ACCESS_LOG_TEMPLATE = {{.Ctx.Req.RemoteAddr}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}\" \"{{.Ctx.Req.UserAgent}}"
{% endraw %}
[security]
INSTALL_LOCK = true