사용자 도구

사이트 도구


nginx:log

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

다음 판
이전 판
nginx:log [2013/03/26 18:26]
kwon37xi 새로 만듦
nginx:log [2020/08/26 15:48] (현재)
kwon37xi [특정 GET query parameter masking]
줄 1: 줄 1:
 ====== nginx log ====== ====== nginx log ======
 +===== 특정 변수를 로그로 남기기 =====
 nginx 의 변수들을 로그로 남기고 싶으면 ''main''외의 ''access_log''를 하나 더 세팅하여 거기서 각종 변수의 값을 출력하는 방식을 써도 된다. nginx 의 변수들을 로그로 남기고 싶으면 ''main''외의 ''access_log''를 하나 더 세팅하여 거기서 각종 변수의 값을 출력하는 방식을 써도 된다.
  
줄 8: 줄 9:
 </code> </code>
  
 +===== 로그 끄기 =====
 +<code>
 +location /resources {
 +    access_log off;
 +}
 +</code>
 +
 +===== 특정 GET query parameter masking =====
 +  * [[https://stackoverflow.com/questions/19265766/how-to-not-log-a-get-request-parameter-in-the-nginx-access-logs|How to not log a get request parameter in the nginx access logs? - Stack Overflow]]
 +  * [[https://forum.nginx.org/read.php?11,234313,234314|Masking query string password in access log]]
 +
 +<code>
 +log_format filter '$remote_addr - $remote_user [$time_local] '
 +    '"$temp" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
 +
 +# Other Configs
 +
 +server {
 +    #Server Configs
 +    location / { # location 을 구체적으로 명시하는게 나을 듯 보임.
 +        set $temp $request;
 +        if ($temp ~ (.*)password=[^&]*(.*)) { 
 +            set $temp $1password=****$2;
 +        }
 +
 +        access_log /opt/current/log/nginx_access.log filter;
 +    }
 +}
 +</code>
  
nginx/log.1364289999.txt.gz · 마지막으로 수정됨: 2013/03/26 18:26 저자 kwon37xi