The remote_log_transfer Script

Valid for versions 108 through the latest version



Last modified: March 27, 2024


Use the /usr/local/cpanel/scripts/remote_log_transfer script to copy the main system and user logs from a server to a backup destination you set in WHM. The script uses the destination from the Additional Destinations tab in WHM’s Backup Configuration interface (WHM » Home » Backups » Backup Configuration).

Run the script

To run this script on the command line, use the following format:

/usr/local/cpanel/scripts/remote_log_transfer --action=[command] [options]


Use the following options with this script:

Options Description Example
--action Required
Use with one of these commands:
  • list — List all log paths whose files the script transfers
  • transfer — Transfer logs to the remote server
/usr/local/cpanel/scripts/remote_log_transfer --action=list
--help Display the script’s help documentation. --help
--morehelp Display the script’s verbose help documentation. --morehelp

The transfer option

Use the following options with the --action=transfer option:

Options Description Example
--debug Show verbose debug output. --debug
--destid Required
The Destination ID from the Additional Destinations tab in WHM’s Backup Configuration interface (WHM » Home » Backups » Backup Configuration). To back up to more than one destination, separate the Destination IDs with commas.
--keep Do not delete the local log file backup after transfer to the remote destination(s). --keep
--local_dir The local directory where the script stores the compressed log files’ tarball before transfer to the remote destination. This option defaults to the /backup directory.
  • If the local directory is on a mounted drive, you must mount it before you use this option.
  • The script uses the local directory path, the server’s hostname, and the backup timestamp to create the tarball filename. The timestamp is in the YYYY-MM-DD:HH:MI:SS format, where:
    • YYYY is the year.
    • MM is the month.
    • DD is the date.
    • HH is the hour.
    • MI is the minute.
    • SS is the second.

For example, if the local directory is /mnt/backups, and you run the script at 14:54:00 on 05/10/2022, the script will create the /mnt/backups/log_backup_server.cpanel.net_2022-05-10-14:54:00.tar.bz2 tarball file.

--remote_dir The path the system uses to store the backups on the remote server. The path can be either relative or absolute to meet the transfer destination’s requirements. This option defaults to the log_backups directory. --remote_dir=backups/logs/Atlanta

Log paths

The script transfers log files from these directories:

  • /var/log
  • /usr/local/cpanel/logs
  • /var/cpanel/logs
  • /var/cpanel/updatelogs
  • /$home/$user/logs, where $home is the user’s home directory and $user is the cPanel account username.

You can add additional custom log paths in the /var/cpanel/config/extra_remote_transfer_paths.txt file. You must use the absolute path to the file, for example:



The following example transfers the logs to the backup destination with the Destination ID of TAMdl6LZCxQELuUAVO20SjQm. It stores the logs in the remote /backups/logs/Atlanta directory and keeps the local backup file in the /mnt/backups directory:

/usr/local/cpanel/scripts/remote_log_transfer --action=transfer --destid=TAMdl6LZCxQELuUAVO20SjQm --remote_dir=/backups/logs/Atlanta --local_dir=/mnt/backups --keep

If the script succeeds, it will return output similar to the following example:

Successful transfer of /mnt/backups/log_backup_server.cpanel.net_2022-05-10-14:54:00.tar.bz2 to /backups/logs/Atlanta/log_backup_server.cpanel.net_2022-05-10-14:54:00.tar.bz2 for destination backupsrv

Additional Documentation