Check Point

Bash Script to SCP Old Log Files in Check Point

One issue that might show up with any type of server is filling up diskspace with log files. This bash script can be modified to SCP and remove any type of file, but this demo bash script is for Check Point Firewalls.

first, you’ll need to find the $FWDIR for your version:

echo $FWDIR

Here is the complete script to scp log files that are older than 30 days, then remove them

# If you want to script the SCP'ing of old files:
find $VERSION/log/*.* -type f -mtime +30 -exec scp {} [email protected]:/home/admin/ \;
# And if you want to delete the files after you SCP them, there are two methods:
find $VERSION/log/*.* -type f -mtime +30 | while read i; do rm "$i"; done

And that's it. Schedule it with cron to test logs each day. If you want to automate it, you'll to setup ssh keys between servers.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.