Apache under error.log file is too large

  • 2020-05-06 12:04:13
  • OfStack

Clear error.log, access.log, and limit the size of Apache log files to
A customer complained that the vps website could not be opened. After checking the login system, the customer was win2003 system. It was found that the D disk where the website files were placed was full and the available space was 0KB.

After searching the relevant information on the Internet and following the steps below, the website returned to normal

Step 1: stop all processes of the Apache service and delete the error.log, access.log files
in the Apache2/logs/ directory
Step 2: open Apache's httpd.conf configuration file and find the following two configurations

ErrorLog logs/error.log
CustomLog logs/access.log common

Comment it out and replace it with the following configuration file.


Limit the error log file to 1M
ErrorLog "|bin/rotatelogs. Es52en-l logs/error-%Y-%m-%d.log 1M "

Generate an error log file
every day #ErrorLog "|bin/rotatelogs.exe -l logs/error-%Y-%m-%d.log 86400"

The restricted access log file is 1M
CustomLog "|bin/ rotatelogs.exe-l logs/access-%Y-%m-% d.log 1M "common

Generate an access log file
every day #CustomLog "|bin/rotatelogs.exe -l logs/access-%Y-%m-%d.log 86400" common

Related articles: