Problem solve Get help with specific problems with your technologies, process and projects.

Prune back the clutter

Prune back the clutter

During day-to-day operations of your network, the different log files in the system start to add up. Depending upon how much security your networks are required to have, the audit logs and system logs can grow to a pretty big size. To alleviate this problem I came up with a very small script that I run as a cron job to ensure that my file system does not fill up. The script uses Solaris's "mtime" function. I have it set to save files up to seven days. Any log files after that are wiped from the system. This allows the administrator the ability to save the files to tape within seven days, before the files are removed.

This script removes old logs greater than one week (seven days).
NOTE: To change the length of retention, change the "7" to whatever length of days needed to keep the files on the system.

(file directory here) -mtime +7 -exec /usr/bin/rm {} ;
This was last published in January 2003

Dig Deeper on Campus area network

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.