Skip to content

Instantly share code, notes, and snippets.

@pauiglesias
Created July 22, 2021 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pauiglesias/020d095f29d0a19db3f95ee8aa05a286 to your computer and use it in GitHub Desktop.
Save pauiglesias/020d095f29d0a19db3f95ee8aa05a286 to your computer and use it in GitHub Desktop.
Set nginx log format with the current host called and total request time
# Log format
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
log_format main2 '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$host" $request_time';
log_format bytes '$body_bytes_sent';
access_log /var/log/nginx/access.log main2;
access_log on;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment