Skip to content

log_hostname

log_hostname is the PostgreSQL setting that controls whether PostgreSQL logs the host name in the connection logs.
Note

Fact — official short description: “Logs the host name in the connection logs.”

Identity

Type , Valuebool
Upstream pg_settings type
Context , Valuesighup
Takes effect after configuration reload
Unit , Value
Raw unit
Range , Value
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueReporting and Logging / What to Log
Upstream classification
Latest boot value , Valueoff
off

Lifecycle

Fact Value
First observed PG9.0 (research boundary)
Present in PG9.0–19 Beta 3
Removed in No
Introduction commit Not asserted: predates the PG9.0 research boundary
Commit date
Discussion

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG9.0–19 Beta 3 off off

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.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
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.
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.
Small nodes Keep log_hostname useful but bounded: verify disk, collector, retention, and redaction capacity before increasing detail or frequency.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP Unmodified
OLAP Unmodified
CRIT Unmodified
TINY Unmodified
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 unmodified; OLAP: PG9.0–19 Beta 3 unmodified; CRIT: PG9.0–19 Beta 3 unmodified; TINY: PG9.0–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

Common pitfalls

  • 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.

application_name · cluster_name · update_process_title · log_line_prefix · log_timezone

References