Welcome! Log In Create A New Profile

Advanced

Access logfile without IP

Posted by krischanb 
Access logfile without IP
September 26, 2020 08:53AM
I am running an application behind a haproxy reverse proxy in ssl pathtrough mode. The application works fine so far. In order to see the remote IP's, and not just the address of the reverse proxy, in the logfiles I followed these instruction:

frontend all_https
option forwardfor header X-Real-IP
http-request set-header X-Real-IP %[src]

Configure a custom log format in Nginx

Add a custom log format named “realip” (but name it the way you want…)

log_format realip '$http_x_real_ip - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';

Use it in your access_log directive

access_log /dev/stdout realip;
access_log /path_to/log/file realip;


Having a look at the nginx logfiles, afterwards I only see a "-" instead of an IP. Without those lines the IP of the Reverseproxy is recorrded.

Maybe someone in here has go a hint.

Best
Krischan
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 60
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready