라벨이 nginx인 게시물 표시

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 끝.