Apache Log Set Logging instance

Source: Internet
Author: User
Tags apache log centos

LogLevel warn
Error log Error_log level is a warning, this level is the default

Logformat "%h%l%u%t \%r\"%>s%b \ "%{referer}i\" \ "%{user-agent}i\" "combined  

Combined log format (Combined log)

%H host name,%l remote registration name%u remote user%t time (in English format)

Represented in the shell as:

[root@test230 logs]# date + "%d/%b/%y:%t%z"
[root@test230 logs]# 16/may/2012:15:16:49 +0800

/"%r/" requests the first line of%>s state,%b bytes sent, matching {referer and user-agent headers, canonical server names in response to the requested server

Referer is the previous page
User-agnet: Browser type

Here is a section of the log that is intercepted:

192.168.169.50--[17/feb/2012:10:09:13 +0800] "Get/favicon.ico http/1.1" 404 "-" 360SE "192.168.169.50--[17/feb /2012:10:36:26 +0800] "get/http/1.1" 403 5043 "-" "mozilla/5.0 (Windows NT 5.1; rv:6.0) gecko/20100101 firefox/6.0 "192.168.169.50--[17/feb/2012:10:36:26 +0800]" Get/icons/powered_by_rh.png HTTP/ 1.1 "1213" http://192.168.55.230/"" mozilla/5.0 (Windows NT 5.1; rv:6.0) gecko/20100101 firefox/6.0 "192.168.169.50--[17/feb/2012:10:09:10 +0800]" Get/icons/powered_by_rh.png HTTP/ 1.1 "1213" http://192.168.55.230/"" mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; trident/4.0; infopath.2; 360SE) "192.168.55.230--[24/feb/2012:09:48:58 +0800]" Get/favicon.ico http/1.1 "404"-"" mozilla/5.0 (X11; U Linux x86_64; En-us; rv:1.9.2.24) gecko/20111109 centos/3.6-3.el5.centos firefox/3.6.24 "192.168.169.50--[24/feb/2012:09:45:03 +0800]" Get/server-status http/1.1 "404 290"-"" mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; trident/4.0; infopath.2; 360SE) "192.168.55.230--[24/feb/2012:09:49:02 +0800]" get/http/1.1 "403 5043"-"" mozilla/5.0 (X11; U Linux x86_64; En-us; rv:1.9.2.24) gecko/20111109 centos/3.6-3.el5.centos firefox/3.6.24 "192.168.55.230--[24/feb/2012:09:49:02 +0800]" Get/icons/apache_pb.gif http/1.1 "2326" http://192.168.55.230/"mozilla/5.0 (X11; U Linux x86_64; En-us; rv:1.9.2.24) gecko/20111109 centos/3.6-3.el5.centos firefox/3.6.24 "192.168.55.230--[24/feb/2012:09:49:02 +0800]" Get/icons/powered_by_rh.png http/1.1 "1213" http://192.168.55.230/"mozilla/5.0 (X11; U Linux x86_64; En-us; rv:1.9.2.24) gecko/20111109 centos/3.6-3.el5.centos firefox/3.6.24 "192.168.55.230--[24/feb/2012:09:49:20 +0800]" Get/server-status http/1.1 "404 290"-"" mozilla/5.0 (X11; U Linux x86_64; En-us; rv:1.9.2.24) gecko/20111109 Centos/3.6-3.el5.centos firefox/3.6.24 "

Logformat "%h%l%u%t \"%r\ "%>s%b" common
Common log formats (Common log format)

%u URL path for request
Logformat "%{user-agent}i" Agent

Customlog Logs/access_log combined
customlog "|/www/apache/bin/httplog-z-B 8192/www/apache/logs/access_%y%m% D.log "combined
Define log file name format: Z for use gzip compression,-B Shou Save 8192, mix


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.