deployment issue (or feature request?) - multiple `include` with `log_format`
Jonathan Vanasco
nginx at 2xlp.com
Fri Nov 18 18:32:42 UTC 2016
I'm not sure if this is a feature request or just an issue with our deployment...
We host many domains, often partitioned across many configuration files
(ie: sites-enabled/domain1.conf,
sites-enabled/domain2.conf,
sites-enabled/domain3.conf,
)
An issue that has complicated our setup is the `log_format` directive. We use a few variations of a log format (different domain groups need/dont-need different data in the logs) and wanted to centrally manage them in a library of `include` files
The problem is that a `log_format` by any given name can only be declared once, so our configuration can not do this:
macros/log_formats/app_custom.conf
log_format app_custom '$remote_addr - [$time_local][$host] $status '...
sites-enabled/domain1.conf
include macros/log_formats/app_custom.conf;
server {
}
sites-enabled/domain1.conf
include macros/log_formats/app_custom.conf;
server {
}
we either have to preload the log formats in the main config, or just define a custom log_format for each domain.
has anyone dealt with this in the past, and found a good solution for deployments (short of requesting an `include_once` feature)?
More information about the nginx
mailing list