Feature request: support access_log in IF block

Rt Ibmer rtibmx at yahoo.com
Fri May 16 17:22:15 MSD 2008


According to the documentation, the access_log directive does not supported the "if in location" context.  This however would be very useful to us and I am sure others.  

For example, within on location block I would like to do this:

location {
  if (url contains something) {
     access_log abc.log main;
  }

  if (url contains somethingelse) {
     access_log xyz.log main;
  }

  ... several more "if" blocks doing the same thing here ...
}

Currently the only way to do this (I think?) is to define multiple location blocks.  However due to the complexity of my config files which already include multiple location blocks as it is with detailed proxy_pass blocks, this would cause several permutations and the log file would quickly grow difficult to manage (and error prone as I change things later and miss changes elsewhere etc).

Thank you for considering this small but useful feature.  If there is already a way to do this please let me know!



      






More information about the nginx mailing list