There are some instances where we may want to log different data, based on some sort of conditional argument. For instance, if you have a beta copy of your application and are interested in gathering more information for it, we can log this data just for the beta URL. Rather than clogging up our log files with the additional information when it's not required, we can simply trigger it when required.
Conditional logging
How to do it...
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...