nginx 로그에 작업시간(요청처리시간) 추가하는 방법



nginx.conf 파일에 다음과 같이 설정한다.


log_format my_format '$remote_addr - $remote_user [$time_local] '

                '"$request" $status $body_bytes_sent '

                '"$http_referer" "$http_user_agent" '

                'time=$request_time';


access_log /var/log/nginx/access.log my_format;



설명

my_format: 아무거나 포맷이름

$request_time: 실행시간을 초로 나타내준다. 나머지 윗부분은 기본으로 있는 로그항목



설정을 로딩해준다.

sudo nginx -t && sudo systemctl reload nginx



끝.


이 블로그의 인기 게시물

반올림 올림 내림 버림(절사) 차이와 구현방법

럭스 원종희 인터뷰 (펌)

MSSQL->ORACLE 연결 TNS 에러