Ok, here's the script. It took me a bit to get this one right, at first I thought I'd just use the date command and pull out the file. Then when I thought it through I realized that each day I'd have to copy out the previous days logs - as logs aren't generated till then. The date command is an under documented utility, but with some help I figured out how to subtract one day from the current.
Any who, once you get this set up it will automatically copy out only the previous days access and error logs, to a directory where they won't get deleted. The way I have the script right now it copies it to a folder called logs_store in your home directory - but you can have them copied anywhere you want.
Just copy and paste this into a simple text file - using note pad or the like. Make sure the commands don't wrap. Save the file, for my example we'll call it logs.sh. Upload the file to your home directory. Here's the shell script:
date +%F -d "1 days ago"
cp /home/username/logs/domain.com/http/access.log.$DATE /home/username/logs_store
cp /home/username/logs/domain.com/http/error.log.$DATE /home/username/logs_store
This script should be 5 lines long. You'll need to replace username with the user who's got control of the domain, and domain.com with the domain's logs you want to backup. If you have more than one domain, simply duplicate each copy command appropriately.
Once you've got that we need to set up your cron job. You'll have to log into SSH (see link above) and edit the crontab (again link above) put this line in:
- 1 * * * /home/username/logs.sh
make sure there's a blank line after your command. And again change out username for the user you put in above. press ctrl-o to save and ctrl-x to exit. You should get a message 'success installing new crontab'
You'll also need to create the logs_store directory. That's in your home directory by my script. As I said before, if you want to you can change this to wherever you'd like.
Let me know if something doesn't make sense.
I'll go ahead and post this to the wiki tomorrow as well...