Troubleshoot Apache error logs with huge problems and turn off Apache web logging

Source: Internet
Author: User
Tags apache error log

Adjust the level of the error log

These days Apache error log huge inexplicable 30G and many are the kind of web site that does not exist too many dead links corresponding also many
And lowered the wrong warning.

Because writing logs can bring a lot of loss to the system. After logging off, even the highest overall performance can be improved by nearly 40% (rough estimate) So how do I close the log?

Log reads and writes can be reduced by reducing the logging level.

It is to be reminded that doing so will cause trouble for "intrusion detection" and other log-based analysis work. So please use it carefully.
Online related articles A lot, but said are not detailed, grazing and past, the following details about the specific operation steps.

Edit the httpd.conf under the Conf folder to find the following:

=====================
#
# Loglevel:control The number of messages logged to the Error_log.
# Possible values Include:debug, info, notice, warn, error, crit,
# Alert, Emerg.
#
LogLevel warn
=====================
Where 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 Example
Emerg 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. "Remature 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.

By changing the errorlog parameter in the httpd.conf configuration file to the following, you can generate a log file on a daily basis.

Errorlog "|bin/rotatelogs.exe-l logs/error-%y-%m-%d.log 1M"
Errorlog "|bin/rotatelogs.exe-l Logs/error-%y-%m-%d.log 86400″

The above is the way to turn off Apache error log!!!

Ways to turn off web logs

In the httpd.conf file, like the next line, you delete it without generating a log. I am the way of commenting, such as:

?
1 #CustomLog "logs/access_log" common

This line may change depending on your configuration, not necessarily identical. You can locate it by searching. The method is so simple. Finally, remember to restart the Web service (without restarting the server) to be effective.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.