This article contains information on Scheduling the export of Messaging Gateway's Control Center Admin Event Logs to a remote host
Since version 10.5.4 of Symantec Messaging Gateway, it is possible to automate and schedule the export of Control Center Admin Event logs to a remote host.
On the SMG appliance
1) Export the SMG RSA pub key and copy it to clipboard by typing the following command:
rsa-key export
Then, copy the content below "The local keyring:" to the clipboard
On the LINUX server
2) Generate a RSA key pair by typing the following command:
ssh-keygen -t rsa
Note: do not enter a password and use default file locations
3) Add the SMG key by editing the following file on the Linux server:
~/.ssh/authorized_keys
Paste the rsa key exported from SMG at step 1
Ensure proper permissions are set on the file using the command:
chmod 600 ~/.ssh/authorized_keys
Then, close and save the file.
4) View the Linux RSA pub key by typing the following command:
cat ~/.ssh/id_rsa.pub
Then, copy the contents to clipboard.
On the SMG appliance
5) Import the Linux RSA pub key with the following command:
rsa-key import '<paste the Linux RSA pub key copied above at step 4>'
6) Test the SSH connection from SMG to Linux with the following command:
rsa-key test [email protected]_IP
On the LINUX server
Create a file with the following script contents and edit the first lines/options as needed.
Notes:
#!/bin/bash SMG_IP='192.168.2.6' LINUX_IP='192.168.2.103' LINUXTMP='/tmp' LINUXDIR='/opt' LINUXUSR='root' #-----------DO NOT EDIT BELOW THIS LINE--------------------------------- rm -rf $LINUXTMP/* echo "* Executing remote commands on the SMG appliance. Please wait..." ssh [email protected]$SMG_IP "diagnostics --logs all scprsa://'$LINUXUSR'@$LINUX_IP/$LINUXTMP" if [[ $? == 0 ]]; then echo "* Operation successful!" else echo "* OOPS! I found some problems, quitting now." exit 1 fi cd $LINUXTMP FILE=$(find $LINUXTMP -name diagnostics*.tar.gz) echo "* Uncompressing diagnostics package" tar xvfz $FILE > /dev/null 2>&1 echo "* Copying Control Center Admin logs to $LINUXDIR" for logfile in $(find $LINUXTMP -name Brightmail_Admin_Events*); do cp $logfile $LINUXDIR done echo "* FINISHED!!"
The script file can now be scheduled to run at desired times. It is recommended to schedule it once every day.