.
: http://itpm.msu.su/manual/ja/logs.html
: Sat Feb 5 01:50:17 2005 : Mon Oct 1 20:03:52 2012 : IBM-866 : |
Apache HTTP ? 2.0
?万?侁? 万?젽 Apache HTTP 乫?主䰭?吲ᰭ 侻?吲ᰭ侄侨?丒? ??侻??
ErrorLog
䫬
Apache 侃Ż?三???
串?
侯丱一
侬䄲?中
乥中 ( unix
error_log
Windows OS/2 error.log
)
Unix ? syslog
三?
侭宐乫렁侵中 侬Ż??? 丮
[Wed Oct 11 14:32:52 2000] [error] [client 127.0.0.1]
client denied by server configuration:
/export/home/live/ap/htdocs/test
?価侵侯?䫨
?侵乻?侭
LogLevel
䰭?
馈三?侮?
㨐䀱侵?? IP
㨀侬??
嫎丄?
䃻 ()
??
?丵並
侾仇 CGI
CGI stderr
中
侬Ż?乀
Ż???? ?丈? ? 侾? 403 ?丈塒 ?侬?万Ż?? 丯
価? ??举䀬 Unix ?
tail -f error_log
???
侬䫯 CustomLog
侯侉??
LogFormat
??
Ż??侄??
?丬Ż??吇? 丒?來习今??侬Ż?? ?吒?侻侫 庮냫侨??侹 吒???侬Ż?? Open Directory Yahoo ?
?? Apache httpd mod_log_config,
mod_log_agent, TransferLog
???
CustomLog
侦
侲ᰭ?
侭宐乫?中仄쒀
宐 C printf(1) 嫻?丫?丨?
嫻?
侄䰾?
嫻?丨侐? mod_log_config 侻
?
丐
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common
common
?
嫻?侐䫇⥢嫻?
??
侬Ż????嫻?
?䏯侭一
丐 ("
) ?
嫻?価䯒?
?젽
嫻?乒 "\n
"夠
"\t
" 毆仄
CustomLog
一
?䯃?
䰨䦈
ServerRoot
侉
侄 Common Log Format (CLF) 䫦 ??侥侧乐侈 ∃吒?쯥 CLF ?乐:
127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET
/apache_pb.gif HTTP/1.0" 200 2326
?侥?侐乐䰄
127.0.0.1
(%h
)HostnameLookups
On
侬嫱?
IP 串侄
??
logresolve
侦??嫱?쾥
主? IP 乥쨫?
书?侇
书?
-
(%l
)identd
RFC 1413 ?
?侬Ż?
䫇?䃯???乨?
Apache IdentityCheck
On
䦈侬Ż???frank
(%u
)REMOTE_USER
?䯠
(?) 401 䃬买笂丮
來乃??䰻
?义䫯 "-
"
[10/Oct/2000:13:55:36 -0700]
(%t
)
[day/month/year:hour:minute:second zone]
day = 2*digit
month = 3*letter
year = 4*digit
hour = 2*digit
minute = 2*digit
second = 2*digit
zone = (`+' | `-') 4*digit
%{format}t
?
⻱侧䰨?
format
C 侥
strftime(3)
侧
"GET /apache_pb.gif HTTP/1.0"
(\"%r\"
)GET
?
/apache_pb.gif
?
? HTTP/1.0
?
侁??吮?
嫻? "%m %U%q %H
"
??吮?
"%r
" 䦭200
(%>s
)2326
(%b
)-
" ??챲
"0
" ?吮?%b
%B
?飼宐 Combined Log Format 䫦 䯨
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
\"%{User-agent}i\"" combined
CustomLog log/access_log combined
侭宐価侻? Common Log Format ⡰
?䀀?〥??
%{header}i
?
header HTTP 侭宐
乐仇:
127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET
/apache_pb.gif HTTP/1.0" 200 2326
"http://www.example.com/start.html" "Mozilla/4.08 [en]
(Win98; I ;Nav)"
?:
"http://www.example.com/start.html"
(\"%{Referer}i\"
)/apache_pb.gif
?
??)"Mozilla/4.08 [en] (Win98; I ;Nav)"
(\"%{User-agent}i\"
)?乆丄主? CustomLog
?䰡
?㡰乇Ÿ CLF 侬Ż?
?䀱䫨䀱 referer 侬Ż?㡰?
CustomLog
ReferLog
AgentLog
侦???
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common
CustomLog logs/referer_log "%{Referer}i -> %U"
CustomLog logs/agent_log "%{User-agent}i"
侾 LogFormat
?젽
侈
CustomLog
侭宐?
?侯万?
????컼 ? 侻?丮
쒃侬?丵?万?
젽乀 SetEnvIf
CustomLog
env=
?䯇?섋?
???:
# Mark requests from the loop-back interface
SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog
# Mark requests for the robots.txt file
SetEnvIf Request_URI "^/robots\.txt$" dontlog
# Log what remains
CustomLog logs/access_log common env=!dontlog
侾⑶?䵃侃? ?
SetEnvIf Accept-Language "en" english
CustomLog logs/english_log common env=english
CustomLog logs/non_english_log common env=!english
乬???临䰭? 侯?侻?? 侁侇仲??举㆑? ?ⵠ???쇻
侥主Ż?侾 乥 10,000 嫸 1 MB ?⇖?? ???젽侮 ?Apache open 䫦中툁 ? open 쐌 ?䃦? 젽
?乇? ???? open ?书? 书中툁젽 ⡯侦侭?? ?㆑??侄?並? :
mv access_log access_log.old
mv error_log error_log.old
apachectl graceful
sleep 600
gzip access_log.old error_log.old
侦??侻?彧?侄䰄
Apache httpd ?一
?䯻中
侲ᰭ?
?侭ń?丵?
?彻 "|
" 丆퇵侈
???侱?
Apache 彧吠?侲丮
侮?
(価侲ᰭ侲ᤃ彧?
䫦?)
彧吠 Apache httpd 侃 ID ?彧吠 乥 root 䯮? ?䰐主?中
彧侭仠価侦?? Apache HTTP rotatelogs 䫦 쥢24 ?? ?:
CustomLog "|/usr/local/apache/bin/rotatelogs
/var/log/access_log 86400" common
侄䰦?奉쐞䰐丆 侾?䦲?
?䫭 cronolog 否? 쁐?
??䫯彧乫?临 ?侦?仒?? ?쾥
?
侐?侻?
↑?
???
<VirtualHost>
?侁丆
?吮?
侮书侊???
>CustomLog
ErrorLog
<VirtualHost>
來
䃬
䰨
吮??
三?侮乬
丈乫?丠侃??丈
?侦侱?
?举䈊萯 Ż??嫻?丒 ?吮??主 ?
LogFormat "%v %l %u %t \"%r\" %>s %b"
comonvhost
CustomLog logs/access_log comonvhost
%v
?侱?
吮?丨split-logfile ?
??
嫸?
乯侮? ?來両 嫸???
Apache 乃 httpd ID ?
logs/httpd.pid
主
PidFile
?
ID 乇?샯
????꾨
Windows -k ???
㬌Ż? 꾨
?
侻?ScriptLog
CGI 侯䫭?
嫠䋨‱乨
Ż? mod_cgi 侻
mod_rewrite
侴
仲ᰭ?
?
RewriteLog
侨
젽???
퇵?侬仒?쭺㬌侊 RewriteLogLevel
䰄