1. # vim/usr/local/apache2/conf/extra/httpd-vhosts.conf
Modify the log file to:
Errorlog "Logs/test.com-error_log" error log
Customlog "Logs/test.com-access_log" combined access log relative path
Apache's Common log format definition:
# vim/usr/local/apache2/conf/httpd.conf
<ifmodule log_config_module>
# The following directives define some format nicknames for use with
# a Customlog directive (see below).
Logformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" combined
Logformat "%h%l%u%t \"%r\ "%>s%b" common
<ifmodule logio_module>
%H: IP address of the client
%l: Client Login Name
%u: Authenticated Users
%t: Date and time of the visit
%r: How customers access, what resources to access, what agreements
%>s request corresponding status code #2开头正常, 3 start is redirected, 4 start client present error, 5 Start server side encounters error
%b: Number of bytes transferred
%{referer}: from which page (such as Baidu Search to the QQ space, that Referer is Baidu
%{user-agent}: What browser does the customer use
# tail-10 Test.com-access_log
192.168.101.175--[01/dec/2015:14:36:52 +0800] "get/misc.php?mod=patch&action =pluginnotice&inajax=1&ajaxtarget=plugin_notice http/1.1 "200 63
There will be a lot of logs every day, how to deal with it?
# vim/usr/local/apache2/conf/extra/httpd-vhosts.conf
Errorlog "Logs/test.com-error_log"
Customlog "|/usr/local/apache2/bin/rotatelogs-l/usr/local/apache2/logs/test.com-access_%y%m%d_log 86400" combined
86400s== Day
# Ls/usr/local/apache2/logs This time the log is divided by day
Test.com-access_20151214_log Test.com-error_log
How does Apache do not log the specified file type?
#!vim
Vim/usr/local/apache2/conf/extra/httpd-vhosts.conf
Setenvif Request_uri ". *\.gif$" Image-request
Setenvif Request_uri ". *\.jpg$" Image-request
Setenvif Request_uri ". *\.png$" Image-request
Setenvif Request_uri ". *\.bmp$" Image-request
Setenvif Request_uri ". *\.swf$" Image-request
Setenvif Request_uri ". *\.js$" Image-request
Setenvif Request_uri ". *\.css$" Image-request
Errorlog "Logs/test.com-error_log"
Customlog "|/usr/local/apache2/bin/rotatelogs-l/usr/local/apache2/logs/test.com-access_%y%m%d_log 86400" combined env=!image-reqest
Apache log cutting with no logging of specified file types