Monitor and record the operation of the Apache Web server

Source: Internet
Author: User
Tags format apache log file contains log apache log

A brief introduction to the log under Apache

Apache provides a wide range of tools for recording all aspects of run-time information. For example, a conditional log, log loop, to determine the IP address and other common problems encountered. There are also a number of third-party modules and tools used to detect the state of your Apache server and to analyze the bundle of its logs.

The default Apache log file

Apache provides a number of detection and logging tools to track the proper operation of the server. The default Apache configuration provides two log files, which are placed in the log directory under the installation directory.

Access_log this file (corresponding to the Access.log file under Windows) contains information about requests that the server has processed, such as the URL of the request, the IP address of the client, whether the request was successfully completed, and so on. Error_log this file (corresponding to the Error.log file under Windows) contains information about the error situation, as well as different large events in the server lifecycle.

Create log format LogFormat "%h %l %u %t "%r" %>s %b" common
LogFormat "%h %l %u %t "%r" %>s %b"
  "%{Referer}i" "%{User-agent}i"" combined
Logformat instructions allow you to tell Apache which aspects of the request you want to record. And you still need additional instructions to tell Apache where to record that information, which will be covered in the next chapter. The following example shows the configuration of two of the most popular formats: the normal log format and the consolidated log format. When Apache receives a request, he will replace each domain with a% prefix with the corresponding request attribute. If you are using the normal log format, each entry in your log file will look like this: 192.168.200.4 - someuser [12/Jun/2005:08:33:34
  +0500] "GET /example.png HTTP/1.0" 200 1234
if you are using the Consolidated log format, each entry in your log file will look like this: 192.168.200.4 - someuser [12/Jun/2005:08:33:34
  +0500] "GET /example.png HTTP/1.0" 200 1234
  http://www.example.com/index.html "Mozilla/5.0
  (Windows; U; Windows NT 5.1; en-US; rv:1.7.7)"
Although the attachment provides a detailed index of the log format, The following table describes some of the most important domains:



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.