Search code examples
postgresqlhostnamepostgresql-14reverse-dns

Why client_hostname is filled while log_hostname=off?


I have to compare the postgresql server connection time with and without client_hostname resolution.

A server is already running in the domain, which have log_hostname=on in postgresql.conf. So a reverse DNS lookup is used to get hostname from client IP.

Now I just created a second postgresql server in the same domain, except this one have log_hostname=off in its config file. Nevertheless, the client_hostname is still filled when I query pg_stat_activity view.

If I check the documentation, I find :

client_hostname text

Host name of the connected client, as reported by a reverse DNS lookup of client_addr. This field will only be non-null for IP connections, and only when log_hostname is enabled.

Why turning it off does not seem to work? Am I missing another configuration?

On the server, Postgresql service has been restarted. The value of the parameter has been set correctly (I check with show all; query in pgAdmin)

This is what I get: host from pg_stat_activity While: log_hostname value


Solution

  • I found why it did not work. In fact, the postgre server IP resolution is set to manual, and DNS addresses were manually filled. Removing these DNS IPs solved my issue