I can get the IP address if the Postgres connection is done from the 5432 port. Now If I connect Postgres with 6432 port means the connection comes from pgbouncer at this time I'm not getting the IP address of the machine getting localhost in the Client IP address tab from pg_stat_activity and in logs also getting the same localhost. I have enabled log_hostname and log_line_prefix also I have added %h and %r to get the IP of the machine from which the connection happed. My purpose is to audit/to get the address for which query or action happened from which machine
1 Answer 1
I got IP in Postgres logs by enabling application_name_add_host in pgbouncer and app name added in log_line_prefix in postgresql.conf
application_name
: pgbouncer.org/config.html#application_name_add_host