Thanks Micah, very useful indeed.

But it only works for nginx' access log, not the error log.

Example from error.log

2018/02/13 10:16:34 [error] 21283#21283: *15 directory index of
"/some/path" is forbidden, client: XX.XX.XX.XX, server:,
request: "GET /thing HTTP/2.0", host: ""

The client bit is the user ip :\

AFAICT from reading the nginx docs [0], it is only possible to configure
the error log path and the log level.

Having access to error logs is useful, arguably more so than the normal
logs, in order to troubleshoot misconfigurations and identify 404s that
should or shouldn't be happening.

Best to disable error logs it seems, and only enable them when debugging.



On January 30, 2018 7:11:59 PM GMT+02:00, micah <> wrote:
>Abel Luck <> writes:
>> Does anyone know of a configuration solution for nginx to meet any or
>> all of these bullet points?
>> * log only the date, not the time or time zone
>> * referer, ip, user-agent are never logged
>> * country is logged by looking up the ip in a geoip database
>> Ideally this would apply to both the standard access log and error
>Drop the following in conf.d/noip:
>        log_format  noip  ' - $remote_user [$time_local] '
>                      '"$request" $status $body_bytes_sent '
>                      '"$http_referer" "$http_user_agent"';
>and then reference it in your log lines, like this:
>access_log  /var/log/nginx/gitlab_access.log noip;
>... it doesn't satisfy your third point, but I don't really feel like
>geoip lookup of IP fits the 'privacy preserving' frame.

List info:
To unsubscribe, email:

Reply via email to