I’d like to use the domain host in the name of the log file. I’m trying to do this with placeholders, but perhaps the log doesn’t have this placeholder.
My Caddy version (caddy version
):
$ caddy version
v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
My Caddyfile looks like:
mydomain.com {
reverse_proxy * someaddress:someport
log {
output file mydomain.com.log
}
}
I tried creating the following that should be an equivalent Caddyfile:
mydomain.com {
reverse_proxy * someaddress:someport
log {
output file {http.request.host}.log
}
}
When I try the above I get:
2020/05/05 16:37:29.503 INFO using adjacent Caddyfile
2020/05/05 16:37:29.527 INFO admin admin endpoint started {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["127.0.0.1:2019", "localhost:2019", "[::1]:2019"]}
run: loading initial config: loading new config: setting up custom log 'log1': loading log writer module: loading module 'file': provision caddy.logging.writers.file: invalid filename for log file: unrecognized placeholder {http.request.host}
start: caddy process exited with error: exit status 1
I want to do this because I have over 40 domain names that I need to change from caddy.log
and it would be great if I can just replace all of them simultaneously.