1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Add GUC to enable logging of replication commands.

Previously replication commands like IDENTIFY_COMMAND were not logged
even when log_statements is set to all. Some users who want to audit
all types of statements were not satisfied with this situation. To
address the problem, this commit adds new GUC log_replication_commands.
If it's enabled, all replication commands are logged in the server log.

There are many ways to allow us to enable that logging. For example,
we can extend log_statement so that replication commands are logged
when it's set to all. But per discussion in the community, we reached
the consensus to add separate GUC for that.

Reviewed by Ian Barwick, Robert Haas and Heikki Linnakangas.
This commit is contained in:
Fujii Masao
2014-09-13 02:55:45 +09:00
parent a2dabf0e1d
commit 4ad2a54805
6 changed files with 38 additions and 2 deletions

View File

@ -4672,6 +4672,22 @@ FROM pg_stat_activity;
</listitem>
</varlistentry>
<varlistentry id="guc-log-replication-commands" xreflabel="log_replication_commands">
<term><varname>log_replication_commands</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>log_replication_commands</> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
Causes each replication command to be logged in the server log.
See <xref linkend="protocol-replication"> for more information about
replication command. The default value is <literal>off</>.
Only superusers can change this setting.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-log-temp-files" xreflabel="log_temp_files">
<term><varname>log_temp_files</varname> (<type>integer</type>)
<indexterm>

View File

@ -1306,6 +1306,8 @@ To initiate streaming replication, the frontend sends the
of <literal>true</> tells the backend to go into walsender mode, wherein a
small set of replication commands can be issued instead of SQL statements. Only
the simple query protocol can be used in walsender mode.
Replication commands are logged in the server log when
<xref linkend="guc-log-replication-commands"> is enabled.
Passing <literal>database</> as the value instructs walsender to connect to
the database specified in the <literal>dbname</> parameter, which will allow
the connection to be used for logical replication from that database.