-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
caddyhttp: Support multiple logger names per host (#6088)
* caddyhttp: Support multiple logger names per host * Lint * Add adapt test * Implement "string or array" parsing, keep original `logger_names` * Rewrite adapter test to be more representative of the usecase
- Loading branch information
1 parent
eafc875
commit 70953e8
Showing
10 changed files
with
249 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
caddytest/integration/caddyfile_adapt/log_multi_logger_name.caddyfiletest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
(log-both) { | ||
log {args[0]}-json { | ||
hostnames {args[0]} | ||
output file /var/log/{args[0]}.log | ||
format json | ||
} | ||
log {args[0]}-console { | ||
hostnames {args[0]} | ||
output file /var/log/{args[0]}.json | ||
format console | ||
} | ||
} | ||
|
||
*.example.com { | ||
# Subdomains log to multiple files at once, with | ||
# different output files and formats. | ||
import log-both foo.example.com | ||
import log-both bar.example.com | ||
} | ||
---------- | ||
{ | ||
"logging": { | ||
"logs": { | ||
"bar.example.com-console": { | ||
"writer": { | ||
"filename": "/var/log/bar.example.com.json", | ||
"output": "file" | ||
}, | ||
"encoder": { | ||
"format": "console" | ||
}, | ||
"include": [ | ||
"http.log.access.bar.example.com-console" | ||
] | ||
}, | ||
"bar.example.com-json": { | ||
"writer": { | ||
"filename": "/var/log/bar.example.com.log", | ||
"output": "file" | ||
}, | ||
"encoder": { | ||
"format": "json" | ||
}, | ||
"include": [ | ||
"http.log.access.bar.example.com-json" | ||
] | ||
}, | ||
"default": { | ||
"exclude": [ | ||
"http.log.access.bar.example.com-console", | ||
"http.log.access.bar.example.com-json", | ||
"http.log.access.foo.example.com-console", | ||
"http.log.access.foo.example.com-json" | ||
] | ||
}, | ||
"foo.example.com-console": { | ||
"writer": { | ||
"filename": "/var/log/foo.example.com.json", | ||
"output": "file" | ||
}, | ||
"encoder": { | ||
"format": "console" | ||
}, | ||
"include": [ | ||
"http.log.access.foo.example.com-console" | ||
] | ||
}, | ||
"foo.example.com-json": { | ||
"writer": { | ||
"filename": "/var/log/foo.example.com.log", | ||
"output": "file" | ||
}, | ||
"encoder": { | ||
"format": "json" | ||
}, | ||
"include": [ | ||
"http.log.access.foo.example.com-json" | ||
] | ||
} | ||
} | ||
}, | ||
"apps": { | ||
"http": { | ||
"servers": { | ||
"srv0": { | ||
"listen": [ | ||
":443" | ||
], | ||
"routes": [ | ||
{ | ||
"match": [ | ||
{ | ||
"host": [ | ||
"*.example.com" | ||
] | ||
} | ||
], | ||
"terminal": true | ||
} | ||
], | ||
"logs": { | ||
"logger_names": { | ||
"bar.example.com": [ | ||
"bar.example.com-json", | ||
"bar.example.com-console" | ||
], | ||
"foo.example.com": [ | ||
"foo.example.com-json", | ||
"foo.example.com-console" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.