. : http://www.arcetri.astro.it/manual/ja/logs.html
: Mon Jan 21 19:44:30 2013
: Thu Feb 27 23:36:09 2014
: IBM-866

: http www.badastronomy.com phpbb index.php
 - Apache <b style="color:black;background-color:#ffff66">HTTP</b> ²î
<-
Apache > HTTP ²î > Áî§Á > î¦Á 2.2



í ۇ֐ˑ

²îʵ²îîÁµ ١î Apache HTTP ²îÁí ۦÁíֵۦ ֵ

top

¨

Apache ۦۦ ²î uid ¨µ root î´ ۦ ¨ۦ

Á µ‘îۦ Áȴ̃ ɑ

top

î

ErrorLog ²î Apache µ ١î̒²î ²î ֵۦ

îۦ ( unix §µ error_logWindows 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

top

¨µ

²î¨µ²îµ ̒¨µ CustomLog  LogFormat ¨§Á¨µ ̒²îֵ

¨µ ۦے ²î ‘î§Á Open Directory Yahoo

î¦Á Apache httpd mod_log_config, mod_log_agent, TransferLog ¦î¨µÁ ȴCustomLog í

¨µۦí ۦ C printf(1) î î î mod_log_config ۦ

Common Log Format

¨µ

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)
²îµÁ (îµ) IP µHostnameLookups On ²îµ IP µۦ̒ ²î logresolve µ IP µî´§Á î´²î§²î µ§Á§ µ
- (%l)
ǡÁ сÁ§Á identd RFC 1413 Á Á î Apache IdentityCheck On
frank (%u)
HTTP Áµ î´ ID CGI µ 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)
²îÁµîƒµî µ (2 î) §Á (3 î) Á î (4 î) ²îî (5 î) µîƒµî µ HTTP (RFC2616 10 )
2326 (%b)
ÁÁ¦ ²¡ÁÁÁ "-" ÁÁ "0" %b %B

Combined Log Format

ۦ 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\")
"Referer" (ہ) HTTP µ Á² (/apache_pb.gif Á î¦)
"Mozilla/4.08 [en] (Win98; I ;Nav)" (\"%{User-agent}i\")
User-Agent HTTP µÁ´

Ր¨µ

Ր¨µՐ 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

Á ȴֵ ²îֵ̒ ֵ

top

ۃ

ͧ²î ¨µ 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

ۃֵԑ

top

ԑ

Apache httpd µۇۦ ۦǡ í²îî Áۦ "|" Áۦ Apache ԑ¨µ²î ²î§ (íԑÁ Ѯԑ)

ԑ¨µ Apache httpd ¨µ ¨µî´ ID Ƀԑ  root с 

ԑ²îۃ Apache HTTP ²î rotatelogs Ѯ 24 ۃ :

CustomLog "|/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common

ѮÁے ¨µî

cronolog ۃ ²

Áԑ ŧÁֵ ֵ

top

îµ

îµ ²î ɑֵֵ µ²î Á²îÁµ <VirtualHost> ¨§Á ¨µî îµ

CustomLog ErrorLog <VirtualHost> î µµî Áîµ Ĵµ²î îµµՐ

¨µîµ îµ µɒ

LogFormat "%v %l %u %t \"%r\" %>s %b" comonvhost
CustomLog logs/access_log comonvhost

%v µɑîµ split-logfile  ¨µ ɒ

î îµî îµî

top



Ր

mod_logio îՐ î (%I %O) LogFormat

Forensic 

mod_log_forensic Áµ forensic µ 1 µ 2 ǡ forensic î΁µƒ¡ ¨îʵ

PID

Apache httpd ¨µ¨µ ID logs/httpd.pid PidFile ۇ¨µ ID ¨µ §îÁ Windows -k Á§Á î¦

µ

ScriptLog CGI µǡ̒ µ²î mod_cgi ۦ



mod_rewrite í  RewriteLog Á¦Áµ ۦֵǡ RewriteLogLevel ȴ

:  en  |  fr  |  ja  |  ko  |  tr 

top

Á

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our mailing lists.