Configuring the PostgreSQL Archive Log Directory

Archive log files are stored in the Archive Log directory. Ensure to follow the below checkpoints before running the PostgreSQL FS backup.


  • Specify the Archive log directory path in the postgresql.conf file prior to performing the PostgreSQL FS backup. Make sure that this path does not point to pg_log or log directories and pg_xlog or pg_wal directories.

    archive_command = 'cp %p /opt/wal/%f' #UNIX
    archive_command = 'copy "%p" "D:\\PostgreSQL\\wal\\%f"' #Windows

  • For PostgreSQL 8.3 version and later, use the following configuration to turn on the archive_mode. This feature is not supported for PostgreSQL 8.2 and earlier versions.

    archive_mode = on

  • For PostgreSQL 9.x.x version, use the following configuration.

    Set wal_level = archive instead of default wal_level = minimal

  • From PostgreSQL 10.x.x version onwards, use the following configuration.

    Set wal_level = replica

  • Verify that the archive command provided in the postgresql.conf file is correct. You can test this by running the following commands and verifying that they successfully complete.

    Select pg_start_backup(‘Testing’);
    Select pg_stop_backup();

Last modified: 9/20/2019 5:15:35 AM