diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/caddyhttp/server.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go index 55da253..38555e7 100644 --- a/modules/caddyhttp/server.go +++ b/modules/caddyhttp/server.go @@ -456,6 +456,20 @@ func (slc ServerLogConfig) getLoggerName(host string) string { if loggerName, ok := slc.LoggerNames[host]; ok { return loggerName } + + // Try matching wildcard domains if other non-specific loggers exist + labels := strings.Split(host, ".") + for i := range labels { + if labels[i] == "" { + continue + } + labels[i] = "*" + wildcardHost := strings.Join(labels, ".") + if loggerName, ok := slc.LoggerNames[wildcardHost]; ok { + return loggerName + } + } + return slc.DefaultLoggerName } |