HTTP clone and push operation logs

186 views
Skip to first unread message

Jacek Centkowski

unread,
Mar 20, 2014, 10:25:59 AM3/20/14
to repo-d...@googlegroups.com
Hi,

I have some issues with clone/push operations over Http and wanted to debug content of this operation and found out that there is HttpLog class and tried to configure it to place logs into httpd_log appender - see below lines for configuration details:

log4j properties configured in this way:
# httpd_log configuration
log4j.logger.com.google.gerrit.pgm.http.jetty.HttpLog=TRACE, httpd_log
log4j.appender.httpd_log=org.apache.log4j.DailyRollingFileAppender
log4j.appender.httpd_log.File=/opt/collabnet/gerrit/logs/httpd_log
log4j.appender.httpd_log.ImmediateFlush=true
log4j.appender.httpd_log.Append=true
log4j.appender.httpd_log.Encoding=UTF-8

file itself was created but it is empty :/ so I have two questions:
1. is there anyway to configure httpd_log so that operations mentioned above are placed there
2. what is the best way to get intel on clone/push operations over http protocol

Thanks and look forward to hearing from you
Regards
Jacek

Hugo Arès

unread,
Mar 20, 2014, 9:21:06 PM3/20/14
to repo-d...@googlegroups.com
Hi,

Are you running gerrit with the embedded servlet container? if yes you must set the following in the gerrit.config and it will programmatically create the httpd_log: httpd.requestLog = true.

Since it is true by default, I assume you are running Gerrit in a servlet container so you should refer to that servlet container documentation to get http request log.

Hugo

Jacek Centkowski

unread,
Apr 9, 2014, 12:27:28 PM4/9/14
to repo-d...@googlegroups.com
Hi Hugo,

thanks for hint. Indeed it was missing parameter. However I have another question regarding log entries. Here are typical fetch lines:
192.168.56.101 - - [06/Mar/2014:20:48:46 +0530] "GET /gerrit/test_repo/info/refs?service=git-upload-pack HTTP/1.1" 401 1299 - "git/1.7.1"
192.168.56.101 - admin [06/Mar/2014:20:49:08 +0530] "GET /gerrit/test_repo/info/refs?service=git-upload-pack HTTP/1.1" 200 523 - "git/1.7.1"
192.168.56.101 - - [06/Mar/2014:20:50:18 +0530] "POST /gerrit/test_repo/git-upload-pack HTTP/1.1" 200 - - "git/1.7.1"

I understand that first it tries with anonymous user. Then authorizes itself (second GET). However what is that I don't get is that while POST is performed there is no additional data in it e.g. username, content-length, etc. I have debugged it and found out that it gets logged before filter responsible for setting for user data is called - that would explain missing user. I haven't found why content length is not there though :/  Is this missing user and other data intended behavior? It removes quite important statistical data out of any automatic log analyzer...


Look forward to hearing from you
Regards
Jacek

Hugo Arès

unread,
Apr 9, 2014, 3:36:41 PM4/9/14
to repo-d...@googlegroups.com
The GetUserFilter is called after but even if I move it up in the filter chain, it is not working. It looks like any request served by gitOverHttpServlet is not storing user where GetUserFilter expect it.

Hugo

Jacek Centkowski

unread,
Apr 16, 2014, 2:35:20 PM4/16/14
to repo-d...@googlegroups.com
Does it mean that there is an error in http logging implementation? Maybe it is logged prematurely and it should happen when request is processed? Does it qualify for issue against current master?

Regards
Jacek

Hugo Arès

unread,
Apr 17, 2014, 11:39:08 AM4/17/14
to repo-d...@googlegroups.com
I tested again and the username is in the http_log for fetch operations. If repo is visible to anonymous user then it will download it anonymously so make sure that only registered users can access the repo to have the username in the log.

Hugo

Jacek Centkowski

unread,
Apr 22, 2014, 6:11:51 AM4/22/14
to repo-d...@googlegroups.com
Hmm... this is not my case as in logs I have posted - anonymous request returns with 401, then request with real account is performed and then fetch but without any user info is logged. I was testing it against 2.7 with httpd layout cherry picked from the master. Which version it was in your case?

Regards
Jacek
Reply all
Reply to author
Forward
0 new messages