APACHEÈÕÖ¾¸ñʽ¶¨Òå,APACHEÈÕÖ¾²ÎÊý˵Ã÷
ÔÚApacheµÄhttpd.confÎļþÖУ¬Í¨¹ýLogFormatºÍCustomLogÖ¸Áî¿ÉÒÔʵÏÖ×Ô¶¨ÒåÈÕÖ¾Îļþ¸ñʽºÍÄÚÈݵÄÄ¿µÄ¡£
ÈÕÖ¾·ÖÎöÊÇÍøÕ¾¿ª·¢Ó¦ÓÃÒ»¸ö·Ç³£ÖØÒªµÄÊֶΣ¬¿ÉÒÔ°ïÖú¿ª·¢ÈËÔ±·¢Ïֺͽâ¾öºÜ¶àÎÊÌ⣡
LogFormatºÍCustomLogµÄ¸ñʽ»¯²ÎÊýÊÇÒ»¸ö×Ö·û´®£¬Õâ¸ö×Ö·û´®»áÔÚÿ´ÎÇëÇó·¢ÉúµÄʱºò£¬±»¼Ç¼µ½ÈÕÖ¾ÎļþÖÐÈ¥¡£
Ëü¿ÉÒÔ°üº¬±»ÔÑùдÈëÈÕÖ¾µÄÎı¾×Ö·û´®ÒÔ¼°¿ØÖÆ×Ö·ûÈ磺¡°\t¡±¡¢¡°\n¡±£¬ ÆäËûµÄÌØÊâ×Ö·û¾ù¿Éͨ¹ý·´Ð±¸ÜתÒå¡£ÇëÇó±¾ÉíµÄÇé¿ö½«Í¨¹ýÔÚ¸ñʽ×Ö·û´®ÖзÅÖø÷ÖÖ¡°%¡±×ªÒåµÄ·½Ê½À´¼Ç¼¡£
ϱíÁгöÁËApacheÈÕÖ¾¸ñʽ×Ö·û´®µÄº¬Òå
%% °Ù·ÖºÅ(Apache2.0.44»ò¸ü¸ßµÄ°æ±¾)
%a Ô¶¶ËIPµØÖ·
%A ±¾»úIPµØÖ·
%B ³ýHTTPÍ·ÒÔÍâ´«Ë͵Ä×Ö½ÚÊý
%b ÒÔCLF¸ñʽÏÔʾµÄ³ýHTTPÍ·ÒÔÍâ´«Ë͵Ä×Ö½ÚÊý£¬Ò²¾ÍÊǵ±Ã»ÓÐ×Ö½Ú´«ËÍʱÏÔʾ¡¯-¡®¶ø²»ÊÇ0¡£
%{Foobar}C ÔÚÇëÇóÖд«Ë͸ø·þÎñ¶ËµÄcookieFoobarµÄÄÚÈÝ¡£
%D ·þÎñÆ÷´¦Àí±¾ÇëÇóËùÓÃʱ¼ä£¬ÒÔ΢Ϊµ¥Î»¡£
%{FOOBAR}e »·¾³±äÁ¿FOOBARµÄÖµ
%f ÎļþÃû
%h Ô¶¶ËÖ÷»ú
%H ÇëÇóʹÓõÄÐÒé
%{Foobar}i ·¢Ë͵½·þÎñÆ÷µÄÇëÇóÍ·Foobar:µÄÄÚÈÝ¡£
%l Ô¶¶ËµÇ¼Ãû(ÓÉidentd¶øÀ´£¬Èç¹ûÖ§³ÖµÄ»°)£¬³ý·ÇIdentityCheckÉèΪ¡±On¡°£¬·ñÔò½«µÃµ½Ò»¸ö¡±-¡±¡£
%m ÇëÇóµÄ·½·¨
%{Foobar}n À´×ÔÁíÒ»¸öÄ£¿éµÄ×¢½âFoobarµÄÄÚÈÝ¡£
%{Foobar}o Ó¦´ðÍ·Foobar:µÄÄÚÈÝ¡£
%p ·þÎñÆ÷·þÎñÓÚ¸ÃÇëÇóµÄ±ê×¼¶Ë¿Ú¡£
%P Ϊ±¾ÇëÇóÌṩ·þÎñµÄ×Ó½ø³ÌµÄPID¡£
%{format}P ·þÎñÓÚ¸ÃÇëÇóµÄPID»òTID(Ïß³ÌID)£¬formatµÄÈ¡Öµ·¶Î§Îª£ºpidºÍtid(2.0.46¼°ÒÔºó°æ±¾)ÒÔ¼°hextid(ÐèÒªAPR1.2.0¼°ÒÔÉÏ°æ±¾)
%q ²éѯ×Ö·û´®(Èô´æÔÚÔòÓÉÒ»¸ö¡±?¡°Òýµ¼£¬·ñÔò·µ»Ø¿Õ´®)
%r ÇëÇóµÄµÚÒ»ÐÐ
%s ״̬¡£¶ÔÓÚÄÚ²¿Öض¨ÏòµÄÇëÇó£¬Õâ¸ö״ָ̬µÄÊÇÔʼÇëÇóµÄ״̬£¬¡ª%>sÔòÖ¸µÄÊÇ×îºóÇëÇóµÄ״̬¡£
%t ʱ¼ä£¬ÓÃÆÕͨÈÕ־ʱ¼ä¸ñʽ(±ê×¼Ó¢Óï¸ñʽ)
%{format}t ʱ¼ä£¬ÓÃstrftime(3)Ö¸¶¨µÄ¸ñʽ±íʾµÄʱ¼ä¡£(ĬÈÏÇé¿öÏ°´±¾µØ»¯¸ñʽ)
%T ´¦ÀíÍêÇëÇóËù»¨Ê±¼ä£¬ÒÔÃëΪµ¥Î»¡£
%u Ô¶³ÌÓû§Ãû(¸ù¾ÝÑéÖ¤ÐÅÏ¢¶øÀ´£»Èç¹û·µ»Østatus(%s)Ϊ401£¬¿ÉÄÜÊǼٵÄ)
%U ÇëÇóµÄURL·¾¶£¬²»°üº¬²éѯ×Ö·û´®¡£
%v ¶Ô¸ÃÇëÇóÌṩ·þÎñµÄ±ê×¼ServerName¡£
%V ¸ù¾ÝUseCanonicalNameÖ¸ÁîÉ趨µÄ·þÎñÆ÷Ãû³Æ¡£
%X ÇëÇóÍê³ÉʱµÄÁ¬½Ó״̬£º
X= Á¬½ÓÔÚÓ¦´ðÍê³ÉÇ°Öжϡ£
+= Ó¦´ð´«ËÍÍêºó¼ÌÐø±£³ÖÁ¬½Ó¡£
-= Ó¦´ð´«ËÍÍêºó¹Ø±ÕÁ¬½Ó¡£
(ÔÚ1.3ÒÔºóµÄ°æ±¾ÖУ¬Õâ¸öÖ¸ÁîÊÇ%c£¬µ«ÕâÑù¾ÍºÍ¹ýÈ¥µÄSSLÓï·¨£º%{var}c³åÍ»ÁË)
%I ½ÓÊÕµÄ×Ö½ÚÊý£¬°üÀ¨ÇëÇóÍ·µÄÊý¾Ý£¬²¢ÇÒ²»ÄÜΪÁ㡣ҪʹÓÃÕâ¸öÖ¸ÁîÄã±ØÐëÆôÓÃmod_logioÄ£¿é¡£
%O ·¢Ë͵Ä×Ö½ÚÊý£¬°üÀ¨ÇëÇóÍ·µÄÊý¾Ý£¬²¢ÇÒ²»ÄÜΪÁ㡣ҪʹÓÃÕâ¸öÖ¸ÁîÄã±ØÐëÆôÓÃmod_logioÄ£¿é¡£
һЩ³£¼ûµÄ¸ñʽ´®£º
ͨÓÃÈÕÖ¾¸ñʽ(CLF)
¡°%h %l %u %t \¡±%r\¡± %>s %b¡±
´øÐéÄâÖ÷»úµÄͨÓÃÈÕÖ¾¸ñʽ
¡°%v %h %l %u %t \¡±%r\¡± %>s %b¡±
NCSAÀ©Õ¹/×éºÏÈÕÖ¾¸ñʽ
¡°%h %l %u %t \¡±%r\¡± %>s %b \¡±%{Referer}i\¡± \¡±%{User-agent}i\¡±"
RefererÈÕÖ¾¸ñʽ
¡°%{Referer}i -> %U¡±
Agent(Browser)ÈÕÖ¾¸ñʽ
¡°%{User-agent}i¡±
apacheÅäÖÃʵÀý¸ñʽ£º
LogFormat "%h %l %u %t %T \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
ÍƼöÐÅÏ¢
- linuxÃüÁîѧϰ±Ê¼Ç£¨11£©£ºnlÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨5£©£ºrmÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨4£©£ºmkdirÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨1£©£ºlsÃüÁî
- ½«CentosµÄyumÔ´¸ü»»Îª¹úÄڵİ¢ÀïÔÆÔ´
- ʹÓÃNginxÌí¼Óheader·ÀÖ¹ÍøÒ³±»frame
- linuxϼÓËÙscp´«Êä´óÎļþµÄËÙ¶È
- linuxϵͳÉ϶ÔnginxÈÕÖ¾·Ö¸î´¦Àí
- lnmp/nginxϵͳÕæÕýÓÐЧµÄͼƬ·ÀµÁÁ´ÍêÕûÉèÖÃÏê½â
- Í»ÆÆÊ®Íò²¢·¢µÄNginxµÄÅäÖü°ÓÅ»¯
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- ²éÕÒ²¢É¾³ý.svnĿ¼Îļþ
- redis ÆßÖÖÊý¾ÝÀàÐ͵ÄʹÓó¡¾°
- linux ÏÂÎļþ¸´ÖƵ½windowsÏÂÂÒÂëµÄ½â¾ö°ì·¨
- nginx³öÏÖ502 upstream sent too big he....
- linuxÏÂsudoÅäÖÃÏê½â
- linuxÃüÁîѧϰ±Ê¼Ç£¨15£©£ºtailÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨14£©£ºheadÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨13£©£ºlessÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨12£©£ºmoreÃüÁî
- ¼ÓÃÜËã·¨±È½Ï3DES AES RSA ECC MD5 SHA1µÈ
ÆÀÂÛ