The remote_log_transfer Script
Valid for versions 108 through the latest version
Version:
108
Last modified: March 27, 2024
Overview
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]
Options
Use the following options with this script:
Options | Description | Example |
---|---|---|
--action |
Required Use with one of these commands:
|
/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. |
--destid=TAMdl6LZCxQELuUAVO20SjQm |
--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.
Note:
For example, if the local directory is |
/mnt/backups |
--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:
|
|
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