0

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

asked Jul 15, 2022 at 7:02
2
  • 1
    I doubt you can achieve that. The only IP address that the Postgres server sees is the one from the server where pgBouncer is running. The only thing you could do is to make that information available in application_name: pgbouncer.org/config.html#application_name_add_host Commented Jul 15, 2022 at 13:28
  • Thanks for the suggestion, 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 Commented Jul 18, 2022 at 7:08

1 Answer 1

0

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

answered Jul 18, 2022 at 7:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.