DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Reporting and Logging / What to Log

log_replication_commands

Logs each replication command.

  • Default: off
  • Type: bool
  • Applies: Session (superuser)

In plain words

Standbys, backup tools and logical replication speak a special replication protocol with commands like START_REPLICATION. This setting logs each of those commands, which helps troubleshoot replicas and backups that fail to connect or start.

For DBAs and operators

Real output (18.6) from psql "replication=database" -c IDENTIFY_SYSTEM:

LOG: received replication command: IDENTIFY_SYSTEM STATEMENT: IDENTIFY_SYSTEM

A physical standby connecting logs IDENTIFY_SYSTEM, possibly TIMELINE_HISTORY 2, then START_REPLICATION SLOT "standby1" 0/5000000 TIMELINE 1; pg_basebackup logs BASE_BACKUP ( … ); logical subscribers log CREATE_REPLICATION_SLOT … LOGICAL pgoutput and START_REPLICATION SLOT "sub" LOGICAL 0/0 (proto_version '4', …). With the setting off, the same line is still emitted, but at DEBUG1.

Useful when a standby keeps reconnecting (you will see a repeating sequence) or a slot "already active" error. Superuser-settable; enabling server-wide is cheap since replication connections are few.

How to change it

A superuser (or a role granted SET) can change it per session with SET.

See it in context

WAL sender Streaming replication Logical replication

Related parameters

max_wal_senders log_connections wal_sender_timeout

All Reporting and Logging parameters