1, log file is too big the first step: Stop all processes of Apache service, delete the Error.log, access.log files under the/var/log/httpd directory Step two: Open the/etc/httpd/conf httpd.conf configuration file and locate the following configuration Errorlog Logs/error.log put the above comment off and change it to # generate an error log file every day errorlog "|/usr/sbin/rotatelogs/var/log/httpd /error_log%y%m%d.log 86400 480 "or # Limit error log file to 1MErrorLog" |/usr/sbin/rotatelogs/var/log/httpd/error_log%y%m%d.log 1M " Locate the following configuration Customlog Logs/access.log combined the above comment off, change # to generate an access log file every day Customlog "|/usr/sbin/rotatelogs/var/log/httpd/ Access_log%y%m%d.log 86400 480 "Common or # Limit access log file to 1MCustomLog" |/usr/sbin/rotatelogs/var/log/httpd/access_log%y%m% D.log 1M "Common 2, in order to prevent frequent write some unimportant error log, improve system performance, it is best to set the error log level to find the httpd.conf configuration file# # Loglevel:control The number of messages logged to the Error_log.# Possible Values Include:debug, info, notice, warn, error, Crit,# Alert, Emerg.# LogLevel warnwhere loglevel is used to adjust the verbosity of the information that is recorded in the error log. (see errorlog Directive). The following levels can be selected, sorted in descending order of importance:Level Description ExampleEmerg Emergency-system not available. "Child cannot open lock file. Exiting "alert must take immediate action. "Getpwuid:couldn ' t determine user name from UID"Crit fatal condition. "Socket:failed to get a socket, exiting child"error condition. "Premature end of script headers"warn warning case. "Child process 1234 do not exit, sending another SIGHUP"Notice general important situation. "Httpd:caught Sigbus, attempting to dump core in ..."Info General information. "Server seems busy, (you could need to increase startservers, or min/maxspareservers) ..."Debug Error level Information "Opening config file ..."The default level is warn, so logs above the warn level will be logged, resulting in a large number of Erro-level error logs that "file does not exist". It is recommended that you use the Crit level setting so that only logs above the fatal level are logged, effectively reducing the number of logs. change the loglevel warn to loglevel crit and restart Apache.
CENTOS7, troubleshooting Apache error log file too big problem