On Thu, Sep 26, 2019 at 12:55 PM shuo dou <
dshowin...@gmail.com> wrote:
> Apache is doing gerrit's reverse proxy,from port 8080 to port 80, how can we display gerrit's user information in the apache log?
That depends on your configuration whether this is possible or not.
This is because you could configure your reverse proxy to do the
authentication, then pass the authorized user to Gerrit, with
auth.type [1] set to one of the HTTP* options.
If using auth.type = HTTP or auth.type = HTTP_LDAP for example, it's
up to your reverse proxy configuration to log the authenticated
username with the request. By default, Apache (2.4, Debian/Ubuntu
which I use) does this already with having '%u' in the default
LogFormat settings. For more information see Apache Module
mod_log_config documentation [2].
If using other authentication mechanisms, your reverse proxy is not
aware of the authentication and cannot log the username, as far as I
know. The best you can do then is looking at Gerrit's httpd request
log [3] and try to correlate it with your reverse proxy logs, in case
that's what you need. (Note that you don't get an HTTP request log
file by default with a reverse proxy, you have to explicitly enable
that, see [3].)
HTH
[1]:
https://gerrit-documentation.storage.googleapis.com/Documentation/3.0.2/config-gerrit.html#auth.type
[2]:
http://httpd.apache.org/docs/current/mod/mod_log_config.html
[3]:
https://gerrit-documentation.storage.googleapis.com/Documentation/3.0.2/config-gerrit.html#httpd.requestLog