Skip to content

Commit

Permalink
Custom nginx log format adding request processing time (#142)
Browse files Browse the repository at this point in the history
Co-authored-by: DOMjudge team <[email protected]>
  • Loading branch information
meisterT and DOMjudge team authored May 6, 2024
1 parent dba58ee commit d810c60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ location / {
location /api/ {
try_files $uri @domjudgeFrontApi;
error_log /var/log/nginx/domjudge-api.log;
access_log /var/log/nginx/domjudge-api.log;
access_log /var/log/nginx/domjudge-api.log dj_access;
}
}

Expand Down Expand Up @@ -52,7 +52,7 @@ location @domjudgeFrontApi {

# Use a separate log file for the API
error_log /var/log/nginx/domjudge-api.log;
access_log /var/log/nginx/domjudge-api.log;
access_log /var/log/nginx/domjudge-api.log dj_access;
}

# The X-Frame-Options header defends against so-called 'clickjacking' attacks.
Expand All @@ -66,4 +66,4 @@ add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block";

error_log /var/log/nginx/domjudge.log;
access_log /var/log/nginx/domjudge.log;
access_log /var/log/nginx/domjudge.log dj_access;
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ upstream domjudge {
server unix:/var/run/php-fpm-domjudge.sock; # if using with etc/domjudge-fpm.conf
}

# Custom log format that adds the request processing time.
log_format dj_access '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent $request_time "$http_referer" "$http_user_agent"';

server {
listen 80 default;
server_name _default_;
Expand Down

0 comments on commit d810c60

Please sign in to comment.