doc: update repmgrd log rotation configuration

In the sample logrotate configuration file, use "copytruncate" rather than "create",
as repmgrd currently doesn't reopen the log file (unless the configuration changes).

Per suggestion in GitHub #465.
This commit is contained in:
Ian Barwick
2018-08-01 16:33:22 +09:00
parent d5b2fa2309
commit 9f07804b6a

View File

@@ -334,14 +334,39 @@ REPMGRD_ENABLED=no
Sample configuration to rotate logfiles weekly with retention for Sample configuration to rotate logfiles weekly with retention for
up to 52 weeks and rotation forced if a file grows beyond 100Mb: up to 52 weeks and rotation forced if a file grows beyond 100Mb:
<programlisting> <programlisting>
/var/log/postgresql/repmgr-9.6.log { /var/log/repmgr/repmgrd.log {
missingok missingok
compress compress
rotate 52 rotate 52
maxsize 100M maxsize 100M
weekly weekly
create 0600 postgres postgres copytruncate
}</programlisting> }</programlisting>
</para> </para>
<note>
<para>
Currently <application>repmgrd</application> will not reopen the log
file unless the configuration is reloaded via <literal>SIGHUP</literal>
<emphasis>and</emphasis> the configuration changes.
</para>
<para>
Therefore it's recommended to use <literal>copytruncate</literal> when
rotating logs, so that the contents of the existing file are rotated out
by creating a copy, then truncating the original file, which
<application>repmgrd</application> still holds open.
</para>
<para>
Note that any logging data written in the (short) timespan after the existing file
is copied, but before it is truncated, will be lost; see the
<ulink url="https://linux.die.net/man/8/logrotate">logrotate documentation</ulink>.
</para>
<para>
This restriction may be lifted in a future &repmgr; version by providing a
signal which causes <application>repmgrd</application> to reopen the log file,
and which can be send from <command>logrotate</command> via a <command>postrotate</command>
script.
</para>
</note>
</sect1> </sect1>
</chapter> </chapter>