The Data Agent generates logs every day and over time this can cause a disk space issue if not properly managed.
The following Linux script was developed to automatically compress log files older than 7 days and delete archived logs older than 30 days.
Uncompress the attached script on the DataAgent server
Change the file to have execute permission using this Linux command:
chmod 744 ArchiveDALogs.sh
Edit the file using vi
Edit the variable FULL_LOG_PATH to set the full path to the logs folder like the example below:
If you need to edit the number of days being compressed you can edit the number 7 in the second line, if you need to edit the number of days until the deletion of the compressed logs, you can edit the number 30 in the 3rd line.
Add a cronjob to run this every day by typing:
Add the following line to have a corn job running everyday at 1 AM.