How to enable serv.log file with app.ini config?

hi!

We need to know who did push/pull to gogs server.
so I need to analyze server access log…
below is kind of sample log file!

[::1] - - [25/Mar/2020:09:03:45 +0900] "GET /myeonghun.noh/git-test.git/info/refs?service=git-receive-pack HTTP/1.1" 401 0 "\" \"git/2.25.1.windows.1"
[::1] - myeonghun.noh [25/Mar/2020:09:03:45 +0900] "GET /myeonghun.noh/git-test.git/info/refs?service=git-receive-pack HTTP/1.1" 200 192 "\" \"git/2.25.1.windows.1"
[::1] - - [25/Mar/2020:09:03:47 +0900] "POST /api/internal/hook/pre-receive/myeonghun.noh/git-test HTTP/1.1" 200 2 "\" \"GitServer"
[::1] - - [25/Mar/2020:09:03:48 +0900] "POST /api/internal/hook/post-receive/myeonghun.noh/git-test HTTP/1.1" 200 97 "\" \"GitServer"
[::1] - myeonghun.noh [25/Mar/2020:09:03:46 +0900] "POST /myeonghun.noh/git-test.git/git-receive-pack HTTP/1.1" 200 115 "\" \"git/2.25.1.windows.1"

i thought access logs will exist at serv.log file.
I saw app.ini configuration page,
but I couldn’t find how to enable this…

I modified app.ini like below…

MODE      = console, file
LEVEL     = Info
ROOT_PATH = C:/Users/Administrator/Downloads/gogs_0.11.91_windows_amd64/gogs/log
ENABLE_ACCESS_LOG = true
ACCESS = file

yes… it was not worked… is there something to enable server access log?

Hi, serv.log does not save request logs. if you want to capture all request logs for git operations, you can:

  1. First, disable SSH, which requires everyone to push/pull via HTTP.
  2. Modify this function to capture request logs only related to Git: https://github.com/gogs/gogs/blob/e14b6abf9dae13bc087c9d9db8fe7c7a5125c792/internal/route/repo/http.go#L44:6
1 Like

Thanks a lot! It was very helpful!!