Question: One of my Linux system log files has suddenly become very large (several hundred megabytes). What should I do?
Answer: The first thing to find out is what exactly is happening in the log files. To see the latest log activity for your web server error log, for example, you would run:
tail -f /var/log/httpd/error.log
If the file is expanding, you should see errors popping up. When you are finished looking at it, press CTRL-C.
The next step is to fix whatever error you are receiving. If it is enough to fill up several megabytes or even a gigabyte of log space, it is a recurring error that should be fixed. For a web server, repeated failed connections could be some type of denial of service (DoS) attack. For a mail server, numerous open connections could mean that someone is using your server to send spam. The key is to find out exactly what the root cause is and then fix it. If you want to clear the log file, run:
Your logs will be back to normal size once your server is running normally again.