I've got a VPS account.
The file:
/home/httpd/..../stats/...-error_log
is logging so many errors that it fills up the 20 GB hard drive space within a 24-hour period which amongst other problems shuts my mail access down, etc.
Most of these errors are repetitive and minor and I'll eventually fix them but how can I first set the error recording up so that it creates various files and deletes the old ones before it makes new ones? This is how I remember it from working on linux web servers I've worked on in the past. I would have thought this would be the default set up actually, isn't it on most VPS servers (My account uses CentOS)?
The best way to limit log size is to use logrotate. Check out "man logrotate" and /etc/logrotate.conf. You can configure it to automatically compress and rotate out logs when they either reach a specific age or size; size being the better choice in your situation.
There's a few options to explore...
First off: you could always just go into the apache config and disable that particular error log until you're ready to work on the problems. Find the ErrorLog line in your /etc/httpd directory and comment it out.
Second: you can run "logrotate" hourly. I'm assuming there's already a daily logrotation and the less than 24 hours thing is what's causing you trouble. On CentOS the config for rotating that log should be in /etc/logrotate.d/httpd -- you can make it size based instead of time-based for that logfile. Unless you pass the hourly version a custom config it will get the log rotation of other files out of sync. Just move or copy /etc/cron.daily/logrotate to /etc/cron.hourly/logrotate for the easy solution.
Third: Look into "rotatelogs". This comes with apache, and has its own manpage. The downside is that it doesn't do deletion, it just splits logs up on criteria (such as size, time, etc). So you'd still need a
Fourth: Log compressed. GZip should get 10:1 compression ratio on most log files. Something like this: ErrorLog "|gzcat > /home/httpd/..../stats/...-error_log.gz" (but make sure you have some kind of working rotation, otherwise you'll have the same problem in a few days)