Ä¿ÇǴнº, ½Ã½ºÅÛ ¿£Áö´Ï¾îÀÇ ½°ÅÍ
  nginx, apache¿¡¼­ POST ·Î±× ³²±â±â ÀÛ¼ºÀÏ : 2014/02/03 18:00
 
  • ±Û¾´ÀÌ : ÁÁÀºÁøÈ£ ( http://coffeenix.net/ )
  • Á¶È¸¼ö : 16044
     
    Á¦  ¸ñ : nginx, apache¿¡¼­ POST ·Î±× ³²±â±â
    ÀÛ¼ºÀÚ : ÁÁÀºÁøÈ£(truefeel, http://coffeenix.net/ )
    ÀÛ¼ºÀÏ : 2014.1.28(È­)

    1. nginx ¼³Á¤

    log_format ¼³Á¤¿¡ $request_body º¯¼ö¸¦ Ãß°¡ÇØÁÖ¸é µÈ´Ù.

    1) http {} ³»¿¡

     
        log_format  post_log '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                           '"$http_user_agent" $request_time "$request_body"';
     


    2) location {} ³»¿¡

     
    # POST log
    if ( $request_method = "POST" ) {
    ¡¡¡¡¡¡access_log  /LOG/httpd-post.log    post_log;
    ¡¡¡¡¡¡access_log  /LOG/httpd-access.log  main;
    }
     


    access_log¸¦ 2°³ ÁöÁ¤ÇÑ °ÍÀº POSTÀÇ ¿äû¿¡ ´ëÇØ 2°³ ·Î±×ÆÄÀÏ¿¡ °¢°¢ ³²±â±â À§Çؼ­´Ù. 1) httpd-access.logÆÄÀÏ¿¡´Â POST¿äûÀ» Çß´Ù´Â ±âº» ·Î±×¸¦, 2) httpd-post.log¿¡´Â POST ±âº» »çÇ× + POST data ·Î±×µµ ÇÔ²² ³²±ä´Ù.

    [ ·Î±× ¿¹ ]
     
    192.168.123.111 - - [28/Jan/2014:16:10:33 +0900] "POST /board/check.html HTTP/1.1" 200 1025 "http://...»ý·«.../board/check.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" 0.001 "mode=editaction&docs=work&viewflg=html&contents=aaaaaaaaaaa"
     



    2. ¾ÆÆÄÄ¡(apache) dumpio ¸ðµâ

     
    DumpIOInput On
    DumpIOLogLevel debug
    LogLevel debug
     


    http://coffeenix.net/bbs/viewtopic.php?p=5824 (2009³â)¿¡µµ ½èÁö¸¸ ´ÜÁ¡ÀÌ ¸¹¾Æ ÀÌ ¸ðµâÀº ÃßõÇÏÁö ¾Ê´Â´Ù.

    - ·Î±×´Â error log ÆÄÀÏ¿¡ ³²°ÔµÇ¸ç
    - ·Î±×°¡ ³Ê¹« ¸¹ÀÌ ³²¾Æ¼­ ½Ç¿ë¼ºÀÌ ¾ø´Ù. (Á¤¸» ³Ê¹« ¸¹´Ù.)
    - ±×¸®°í, ¾î¶² IP¸¦ ³²±âÁö ¾ÊÀ¸¹Ç·Î ¾îµð¼­ ¿äûÀÌ µé¾î¿Â °ÍÀÎÁö ¾Ë ¼ö ¾ø´Ù.
    - POST¸¸À» À§ÇÑ ¸ðµâÀÌ ¾Æ´Ï¹Ç·Î, GET ¿äûÀÇ °æ¿ìµµ Request °ªÀÌ »ó¼¼ÇÏ°Ô ·Î±×·Î ³²´Â´Ù.


    3. ¾ÆÆÄÄ¡ dumpost ¸ðµâ

    POST µ¥ÀÌÅ͸¦ ·Î±×·Î ³²±â´Â mod_dumpost ¸ðµâ( https://github.com/danghvu/mod_dumpost )À» ¼³Ä¡ÇÑ´Ù.

     
    DumpPostHeaderAdd Content-Type
    DumpPostLogFile /LOG/httpd-post.log
     


    - DumpPostHeaderAdd : ·Î±×¿¡ Ãß°¡·Î ³²±æ Çì´õ¸¦ ÁöÁ¤ÇÑ´Ù. ¿©·¯ Çì´õ¸¦ ÁöÁ¤ÇÒ °æ¿ì 'Referer Host Cookie Content-Type' ó·³ °ø¹éÀ¸·Î ±¸ºÐÇÏ¸é µÈ´Ù. ±×·¯³ª Content-Type ¿Ü¿¡´Â ÁöÁ¤ÇÏÁö ¾Ê´Â°Ô ÁÁ´Ù. ´Ù¸¥ Çì´õ¸í±îÁö ÁöÁ¤ÇÒ °æ¿ì ±× Çì´õ°¡ GET¿äû¿¡µµ Æ÷ÇԵǾî ÀÖ´Ù¸é GET¿äûµµ ·Î±×¿¡ ³²±â ¶§¹®ÀÌ´Ù.
    - DumpPostLogFile   : ·Î±×ÆÄÀϸíÀ» ÁöÁ¤ÇÑ´Ù. ÁöÁ¤ÇÏÁö ¾ÊÀ¸¸é error log¿¡ ³²±ä´Ù. ´Ü, error log¿¡ ³²À» ¶§´Â LogLevelÀÌ Info ÀÌ»ó¾î¾ß ÇÑ´Ù.

    [ ·Î±× ¿¹ ]
     
    [Tue Jan 28 17:36:19 2014] 192.168.123.111 "POST /board/check.html HTTP/1.1" application/x-www-form-urlencoded mode=editaction&docs=work&viewflg=html&contents=aaaaaaaaaaaaa
     



    Ä¿ÇǴнº, ½Ã½ºÅÛ ¿£Áö´Ï¾îÀÇ ½°ÅÍ / URL : http://coffeenix.net/board_view.php?bd_code=1745