log_hostname
Read PG 18 manual ↗By default, connection log messages only show the IP address of the connecting host.
- Type
- bool
- Context
- sighup
- Measured default
- off
- Unit
- —
- Metadata snapshot
- 18
Definition PG 18 manual
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.
Measured default history
| Version interval | Default |
|---|---|
| 9.0 – 19 | off |
Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗
How it works
log_hostname logs the host name in the connection logs. By default, connection logs only show the IP address of the connecting host. If you want them to show the host name you can turn this on, but depending on your host name resolution setup it might impose a non-negligible performance penalty. Reverse DNS is performed to turn client addresses into names, which can add connection latency or stalls when name service is slow.
log_hostname is a SIGHUP-context setting: a configuration reload activates the new server value without a restart; subsequent operations that consult it use the refreshed value.
It changes emitted diagnostic data rather than query semantics, but volume, sensitive content, log_line_prefix, destinations, collector throughput, and retention determine operational cost and usefulness.
Operational considerations
Editing log_hostname without reloading configuration and verifying the effective value and subsequent behavior.
Enabling richer logging without budgeting collector throughput, storage, retention, and downstream query cost.
Writing SQL text, bind values, identities, or host data without a redaction and access-control policy.
Turning on reverse DNS where resolver latency lies on the connection path.
Workload guidance
OLAP: Analytical jobs can justify richer log_hostname telemetry, but account for long statements, large bind values, and bursty completion patterns in the log pipeline.
OLTP: Tune log_hostname against an explicit observability question and a measured log-volume budget. Prefer selective thresholds, sampling, or role-level overrides over indiscriminate capture.
SMALL: Keep log_hostname useful but bounded: verify disk, collector, retention, and redaction capacity before increasing detail or frequency.
Related entries
Further reading
Definition snapshot: english-manuals:0ce15afe6095d30525a69f54578… · English manual source