August 2017
Intermediate to advanced
278 pages
8h 53m
English
To enable, we map the ($args) URI arguments to a $debuglogs variable, based on if a condition is set. Here's the code:
map $args $debuglogs {
default 0;
debug 1;
}
Like the custom log formats, this needs to be placed outside of the server directives. Then, within the server directive, we can make use of the variable and create additional logging:
access_log /var/log/nginx/djangodemo-debug-access.log applogs if=$debuglogs; access_log /var/log/nginx/djangodemo-access.log combined;
If we call a normal URL, it will simply log the access to the standard djangodemo-access.log in the combined format. If we call a URL with the debug argument set (for example: http://djangodemo.nginxcookbook.com/?debug), we now get the details logged ...
Read now
Unlock full access