<-
Apache > HTTP Server > Documentation > Version 2.4

� /h1>
¹® 5 � 5±Ù ó°� �) ¹® � Âü� .

�(< � �� ´¸� ¤¸� � ¹® � � � �� 9 � � ¸Å È©4 � �� ±â� °ø ¹® �� ±â� � ¹æ � á±� �4 �) �

Âü

top

º¸ °æ

±º � 9 á±� � ¸® °±�� ¤¸� (º¸ root) �� � uid� °Å � � � °ï '� á±� � ¸® °±�� ÁÖ �/em>. � �) º¸ ¹® � Âü

, ��48 � °ø º¸ á±� � °Å ±× � ±â ±× � ��48 � á±� � ´¹�� � � �, á±� ¤·� ÁÖ4

top

� �� (Error Log)

ErrorLog � � $ á±� � � � á±� � � 9� ' 9 � � � � º¸ 2 2¸® $ � � � ±â �� °Å ¹® � ¤¸� ¹« ¸ø � � �� �9'� ¤Á� ´°� � ¸Õ � �

� á±� º¸ (� � error_log, � OS/2 error.log) � ±â � � � � syslog � � �) ¤¸� á±� /a>� º¸

� á±� � � � ±×� �� � �� �� °ø �< � º¸ � � �� º¸ � � �

[Wed Oct 11 14:32:52 2000] [error] [client 127.0.0.1] client denied by server configuration: /export/home/live/ap/htdocs/test

�� �� ù ' �� ' �4 �' �� º¸ � �� � LogLevel � � á±� ±â � �� � ' �� � � � ��48 � IP ÁÖ4 � � � ¹® ¤¸�, °æ �� ��48 � ±Ù °Å � �$ 2 ¹® ( °æ � ) �$ °æ º¸8

� á±� ¸Å � "� ¹®±¸� �� ¾w CGI � ¬¸�� �� Ãä � á±� ±â CGI � ¬¸�� stderr º¸ ±× � � á±� º¹,

� á±� º¸ 6�� � ±×� 2 � á±� °æ � ��/a> �� ±ä � � °æ =� 403 � �� �� ±ä � á±� �) � � � Âü � � 6°º� �

°ß � ¹® � ±â ' � á±� � � ´º� � " � � � �

tail -f error_log

top

� �� (Access Log)

� � á±� �� 2¸® ¸ð 2 ±â CustomLog � � á±� 9 �) ' LogFormat � �) á±� � � �) � �� � á±� �) � ¹æ �

¹° � á±� º¸ ±â � �� ´¸� ¿ô � � º¸ � � � � � ¬´ ¹® � �� � � ¤·�' ¼¸�, �� � � � �� � �� � º¸ á±� � �(4 � Open Directory Âü

9 � � � � mod_log_referer, mod_log_agent, CustomLog � ¸ð � � �) � á±� ¤·� '� CustomLog � � �� ¸ð ±â� �4

� á±� ¸Å �) �% C printf(1) ¹®4°ú ¸Å � ¹®4 �) ' � � � ¹®4 �)� ¸ð �) ¤¸� mod_log_config ¹® /a> Âü

Common ��

� � � � � �

LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common

±×ì¸� ' �� ¹®4 �� common� ¹®4 �< �� ±¸1 � �� � º¸ ±â ' ¸° ¹®4 � ¹® � ¼¸� ±× � á±� Ãä �4 ¹® (")� Ãä � �ä¸� ¹é,� ½¬ ¹®4 ¹®4 $�� "\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)
� 2 ��48 � �$ IP ÁÖ4 HostnameLookups� On�ü¸� �$ � ã IP ÁÖ ¸® � ±×� � �� ¸Å ¸® � � 62' �$ � ¤¸� $ logresolve � á±� 2¸® á±�� �) � " ¬±� IP ÁÖ �) � �) ÄÄ � ÁÖ � � �� �) ¼¬4 Á¸, ¤¸�, ÄÄ � ÁÖ � � ÁÖ � ±â ¬´
- (%l)
Ãä "»©±â±â 2 º¸ � °æ ¬±� º¸ ��48 ÄÄ � � identd� °ø ��48 � RFC 1413 � º¸ ¸Å ¹Ï ±â ¹® , ±ä ´¸� � � � ¼¸� � º¸ �) � IdentityCheck� On ¼¸� 9 � � º¸ º¸� '
frank (%u)
� HTTP �< ¹® � 2 �) userid� º¸ � CGI � ¬¸�� � REMOTE_USER °æ � °Ü 2 =� 401�ü¸� ( Âü ) �) � ' � °Å ' � � � ¹Ï<¸é ¹® � � º¸ � ' ¤¸� �� � ��� � "-"�
[10/Oct/2000:13:55:36 -0700] (%t)
�� 2¸® �9 �. :

[day/month/year:hour:minute:second zone]
day = � 2�
month = � 3�
year = � 4�
hour = � 2�
minute = � 2�
second = � 2�
zone = (`+' | `-') � 4�

�� ¹®4 %{format}t� �) ¤¸� � � Ãä format C $ �4ì¸� strftime(3)� �
"GET /apache_pb.gif HTTP/1.0" (\"%r\")
��48 � 2 �4 � ¹­, 2 ¸Å � º¸ � ù°, ��48 � �) ¸å GET� ' ��48 � /apache_pb.gif� 2 � ' ��48 � HTTP/1.0 �= �) 2 � �� � á±� � � ¹® "%m %U%q %H" "%r"� � ¸å , °æ , '¹® �= á±�
200 (%>s)
� �� ��48 � � º¸� Ää º¸ (2� =) 2 ±°�', (4� =) ��48 � � � ', (5� =) � � � ' ¤Á��� ¸Å $ = 2 ¸ñ HTTP � (RFC2616 section 10) ã
2326 (%b)
�'� �� � � � � ��48 � � º¸� �) ¬±�� � ��48 � � º¸� �) ¤¸� � "-"� �) °æ "0" á±� ¤¸� %B� �)

Combined ��

# �) ¤¸� ¹®4 °á � á±� (Combined Log Format)� � � � �)

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
CustomLog log/access_log combined

�� 6� � � � Common �� � � 6� ��� �< ' %{header}i� �) ¬±� header ¸® HTTP 2 � � � á±� � � �

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)"

6� ��:

"http://www.example.com/start.html" (\"%{Referer}i\")
"Referer" (çÃ� ¸® ) HTTP 2 � . ��48 � ÂüÁ¶� �� � �4 �4 (&, /apache_pb.gif� ¸È °Å � � �4 �4 )
"Mozilla/4.08 [en] (Win98; I ;Nav)" (\"%{User-agent}i\")
User-Agent HTTP 2 � . ��48 �<0 � ¸® óº�4

� � ��/a>

�< � CustomLog � �) � � á±� �� ¸Å4 � � � � � ' � á±� � ù ° ±âº» CLF º¸ ±â �, òÂ� � ° referer �<0 º¸ ±â �'� 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 � ' �� '

Á¶°Ç� ��/a>

��48 2 ±°� � � �� � á±� ±â '� � � °æ � �) � � ´°� ¸Õ , ��48 � � Á¶°Ç çÁ� � °æ � � º¸ SetEnvIf� �) ±×¸®� CustomLogenv= �) °æ ¹« � 2 �ã°� � � ¤¸�:

# loop-back � � �$ 2 br /> SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog
# robots.txt � 2 br /> SetEnvIf Request_URI "^/robots\.txt$" dontlog
# ¸Ó � á±� ¨±�br /> CustomLog logs/access_log common env=!dontlog

¤¸� � � �) 2 á±� � ±â �, »¦ �) 2 ¤¸� á±� � ±â °æ0 �4º¸.

SetEnvIf Accept-Language "en" english
CustomLog logs/english_log common env=english
CustomLog logs/non_english_log common env=!english

Á¶°Ç� á±� ¸Å �% � � '�, � �� �) Á¶ � ¹æ á±� � � ¸ð ±â � $ ' 2 � � á±� � � � �

top

�� (Log Rotation)

Á¶ � òÁ¶Â� á±� � � º¸ ¸Å � á±� º¸ �� 2 1MB � &� °á°ú� ±âÁ¸ á±� �°°� ® ¹æ� á±� ÁÖ±â� � 9 � � � � á±� � °±â¹� �� � �< á±� á±� � �°°� � �� á±� � � �4

� �) � � ��48 � ±âÁ¸ � ±â °°� '� á±� � ±×� � � � 2 ºþ � � á±� � � �) � ±×� � � á±� � 2¸® � � � ±âä¸� � �� � � � á±� �, � ¬°�� � ±â � á±� 6

mv access_log access_log.old
mv error_log error_log.old
apache2ctl graceful
sleep 600
gzip access_log.old error_log.old

á±� ¤¸� ¹æ � � � ��/a>� �) ¬´

top

á±� � � º¸ô±�

9 � � � á±� � á±� � ' � � � � � ¤¸� ·Ö$ º¸ ±â� �) � � =� 6�'� ¸Å � � á±� 2¸® á±� � °±� � ¸® � ¹® "|" � �%< �� �� � � � ¼¸� 9 �� � � °°� �� ·Ö$ �, �� � ·Ö$ Á×<¸é � ( �'� ±â� ¹® °¸� ¹æ "¹Ï � á±� ö¸� )

� � °°� �� ·Ö$ �� 9 httpd ·Ö$ � , ·Ö$ userid � &, � � °°� �� á±�� º¸ root� � ±×� � á±�� �( � � � � ¸Å $

� � ö¸� 2 ¸÷4 �4 � ¹­ ¸ó � á±� ¬´ �, � á±� çÂ� '

�� � '� á±� � � á±� �) $ � 9 � � � rotatelogs� �( á±�� � � � � 24�� á±� ¤¸�:

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

¤¸� �4 � cronolog� ¾w '� � � �� á±��

Á¶°Ç� á±� � � á±� ¸Å �% ±¸ �, $ 2¸® � �( ¹æ �% °æ �) �

top

°¼$ /a>

� °¼$ /a>� �� � �� ' ¹æ� á±� � ¤·� ¸Õ , �$ � � � � á±� �) � ÁÖ � � �� � � ¸ð 2 � � á±� � á±� ±â ¹æ °¼$ � � � � 2¸®

CustomLog ErrorLog � �) � � °¼$ � ̳� � � ' � ±â �� � ¤¸� °¼$ � � ÁÖ � á±� á±� ±â ¹æ °¼$ �� °æ ¸Å � '�, �$ � ¸Å¸é ´¸� � �4 , ¼±�� öÁ� ¹® � # �

� á±� °æ ¸Å " ´°�1 �� ¹®4 °¼$ � º¸ 6�� ¸ð �$ � � á±� �) �, $ á±� °¼$ � � � � � � �

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

%v 2 ºþ °¼$ � ±â $ split-logfile � á±��< � á±� °¼$ �

top

¤¸� á±� /a>

PID /a>

9 � � logs/httpd.pid � �� httpd ·Ö$ process id� � � PidFile � ó°� process-id ´¸� � �� ·Ö$ ±× º¸ �� � °Å Á×< �) � -k ¸÷ � �) � º¸ �(°ú � � � Âü

� ¬¸� ��/a>

�� ±â ScriptLog � �) CGI � ¬¸�� ¥°� Ãä ±â � � � �)< � �) � � �) � �) � � º¸ mod_cgi ¹® � Âü

� ��/a>

mod_rewrite �% � º¹! ±â� �) ¤¸� �� °Å RewriteLog� �) � á±� � � ' �� 2 �' � � � RewriteLogLevel � Á¶

�% �  en� |  fr� |  ja� |  ko� |  tr�

top

Comments

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.