Capturing both IP address and hostname in the log - Mailing list pgsql-general

From Tefft, Michael J
Subject Capturing both IP address and hostname in the log
Date
Msg-id BN8PR04MB550874EE58EC715656C3D3D2D0B72@BN8PR04MB5508.namprd04.prod.outlook.com
Whole thread Raw
Responses Re: Capturing both IP address and hostname in the log
Re: Capturing both IP address and hostname in the log
List pgsql-general

The documentation for log_hostname says:

log_hostname (boolean)

By default, connection log messages only show the IP address of the connecting host. Turning this parameter on causes logging of the host name as well. Note that depending on your host name resolution setup this might impose a non-negligible performance penalty. This parameter can only be set in the postgresql.conf file or on the server command line.

 

https://www.postgresql.org/docs/14/runtime-config-logging.html

 

We have set log_hostname ON and we get hostname reported – but we do not get IP address. We would like to capture both.

Since the doc says “Turning this parameter on causes logging of the host name *as well*” we were hoping we would capture both, but we are not getting what we expect.

 

Is there a way to capture both IP address and hostname in the log messages? Or must we choose “one or the ootehr”?

 

Thanks,

Mike Tefft

 

(We are using PG14 and PG16, but the docs say the same thing, as does PG17)

pgsql-general by date:

Previous
From: Achilleas Mantzios
Date:
Subject: Re: timescaledb vs NULL vs pg_timeseries vs partman + pgcron + pg_ivm
Next
From: Justin Swanhart
Date:
Subject: Archive logging not cleaning up pg_wal directory