Apache configuration for log format:

Source: Internet
Author: User

Apache has documents that provide a detailed index of the log format, the following are some of the most important domains:
Normal log format:
%H: When a client (for example, a browser) makes a connection request to the server, its own IP address or domain name (to open hostnamelookups).
%u: The number of the user under the record when authenticating a user using the HTTP method.
%t: The time the server receives the connection request.
%r: The textual information from the original connection request issued by the client, containing the HTTP method used.
%>s: The return status code after the server answers the browser, 200 indicates the request was successful.
%b: The content size (in bytes) of the postback object of a single request sent by the server answering browser, not counting packet header bytes.
The consolidated log format expands two additional domains based on the common log format:
%{referer}i: The header of the connection request packet, which contains the document association information that points to the current page. (Why should I have "I"?) )
%{user-agent}i: The user Agent connection request packet header, which contains information about the client's browser. (Why should I have "I"?) )

For example (the following common1 and combined1 can be freely named by you, note that it is possible that Apache configuration does not accept numbers, I am here just to cite an obvious example: p):
Logformat "%h%l%u%t/"%r/"%>s%b" Common1
Logformat "%h%l%u%t/"%r/"%>s%b/"%{referer}i/"/"%{user-agent}i/"" combined1 "

-----------------------------------
setenvif Request_uri "(/.gif|/.jpg) $ image1
Customlog Logs/access_ Log logformat-defined named Env=!image1 (without recording images in GIF and JPEG format)
setenvif remote_addr 192/.168/.200/.5 specialmachine1
Transferlog Logs/sample.log (automatically accept the definition provided by the last Logformat Directive) ENV=SPECIALMACHINE1 (record specific IP address)
Setenvifnocase Referer www /.example/.com Internalreferral1 (satisfies the condition if the www.example.com site is not linked)

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.