An easy way (shell script) to rotate log files in Linux can be:
#!/bin/bash
# Include the following line in crontab:
#00 5 * * * /bin/rotate_logs.sh > /dev/null 2>&1
#
DATE=`date "+%Y%m%d"`
cd /var/log/
for i in messages secure cron lastlog
do
cp ${i} ${i}.${DATE}
> ${i}
gzip -9 ${i}.${DATE}
done
/etc/init.d/syslog restart
If you have any other log to rotate, you can change the line 8 and 10.
Print
del.icio.us
Facebook
Twitter
Google Bookmarks
Add to favorites
email