{"Entry":{"collection":"guc","key":"log_replication_commands","name":"log_replication_commands","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Reporting and Logging / What to Log","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"9.4","status":"added","to":"9.5"},{"documentation_changed":true,"fields":{},"from":"9.5","status":"changed","to":"9.6"},{"documentation_changed":true,"fields":{},"from":"9.6","status":"changed","to":"10"},{"documentation_changed":true,"fields":{},"from":"10","status":"changed","to":"11"},{"documentation_changed":true,"fields":{},"from":"11","status":"changed","to":"12"},{"documentation_changed":true,"fields":{},"from":"13","status":"changed","to":"14"},{"documentation_changed":true,"fields":{},"from":"14","status":"changed","to":"15"},{"documentation_changed":true,"fields":{},"from":"16","status":"changed","to":"17"},{"documentation_changed":true,"fields":{},"from":"17","status":"changed","to":"18"}],"content_hash":"39d1482f2fea8d0e4fa8cd8692859cd850e7278a62cad5a10fc8d9daf32f1dd7","context":"","default_changed_in":[],"default_history":[{"from":"9.5","to":"19","value":"off"}],"editorial":{"advice":{"olap":"Analytical jobs can justify richer log_replication_commands telemetry, but account for long statements, large bind values, and bursty completion patterns in the log pipeline.","oltp":"Tune log_replication_commands 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_replication_commands useful but bounded: verify disk, collector, retention, and redaction capacity before increasing detail or frequency."},"mechanism":["log_replication_commands logs each replication command. It covers replication-protocol commands as well as SQL replication commands and can therefore expose replication topology and slot activity.","log_replication_commands is a SUPERUSER-context setting. Superuser or a role granted the appropriate SET privilege can change it for a session, while ALTER ROLE or ALTER DATABASE can establish a default for future sessions.","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."],"pitfalls":["Changing log_replication_commands in one session and assuming role defaults, database defaults, or other pooled sessions changed with it.","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.","Changing log_replication_commands globally without a rollback plan and a client or operational compatibility test."],"references":[{"title":"PostgreSQL 19 Beta 4: log_replication_commands","url":"https://www.postgresql.org/docs/19/runtime-config-logging.html#GUC-LOG-REPLICATION-COMMANDS"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["log_checkpoints","log_autovacuum_min_duration","log_lock_waits","log_lock_failures","log_temp_files"],"summary":"log_replication_commands is the PostgreSQL setting that controls whether PostgreSQL logs each replication command."},"enumvals":[],"first_version":"9.5","group":"Reporting and Logging","group_slug":"logging","imported_at":"2026-09-30T00:40:57.406718+08:00","intro_commit":{"authored_at":"2014-09-13T02:55:45+09:00","discussion":[],"hash":"4ad2a548050fdde07fed93e6c60a4d0a7eba0622","subject":"Add GUC to enable logging of replication commands.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=4ad2a548050fdde07fed93e6c60a4d0a7eba0622"},"key":"log_replication_commands","last_version":"20","max_val":"","min_val":"","name":"log_replication_commands","position":243,"present_in":["9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"short_desc":"Causes each replication command and walsender process's replication slot acquisition/release to be logged in the server log.","short_desc_zh":"","source_rev":"english-manuals:bfcbcbcc219bd91c06e9999584a08d566b51890deeb35f7198888cb2eaa7fbb4","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"log_replication_commands","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"log_replication_commands","SourceRevision":"english-manuals:bfcbcbcc219bd91c06e9999584a08d566b51890deeb35f7198888cb2eaa7fbb4","Facts":{"boot_val":"off","category":"Reporting and Logging / What to Log","context":"superuser","description":"Causes each replication command and walsender process's replication slot acquisition/release to be logged in the server log. See Section 54.4 for more information about replication command. The default value is off. Only superusers and users with the appropriate SET privilege can change this setting.","doc":{"anchor":"GUC-LOG-REPLICATION-COMMANDS","file":"runtime-config-logging.html","lang":"en","sha256":"93c48c522a72fca19705c4c91a71e951eae653662008eee2e4a9a74a11127fde","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"log_replication_commands","short_desc":"Logs each replication command.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-LOG-REPLICATION-COMMANDS","file":"runtime-config-logging.html","lang":"en","sha256":"93c48c522a72fca19705c4c91a71e951eae653662008eee2e4a9a74a11127fde","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"log_replication_commands","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"log_replication_commands","Summary":"","BodyHTML":"\u003cp\u003e在服务器日志中记录每个复制命令，以及\u003ccode\u003ewalsender\u003c/code\u003e进程获取和释放复制槽的操作。有关复制命令的更多信息，请参见\u003ca href=\"/docs/18/protocol-replication.html\" rel=\"nofollow\"\u003e第 54.4 节\u003c/a\u003e。默认值为\u003ccode\u003eoff\u003c/code\u003e。只有超级用户和具有适当\u003ccode\u003eSET\u003c/code\u003e权限的用户才能更改此设置。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"e9a1c7d4b23f1b2cb7c5543f15480222791be3b1ca3ed8bb5c5cd2df9ace887d","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e在服务器日志中记录每个复制命令，以及\u003ccode class=\"literal\"\u003ewalsender\u003c/code\u003e进程获取和释放复制槽的操作。有关复制命令的更多信息，请参见\u003ca href=\"/docs/18/protocol-replication.html\" title=\"54.4. 流复制协议\"\u003e第 54.4 节\u003c/a\u003e。默认值为\u003ccode class=\"literal\"\u003eoff\u003c/code\u003e。只有超级用户和具有适当\u003ccode class=\"literal\"\u003eSET\u003c/code\u003e权限的用户才能更改此设置。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
