1. Caddy version (caddy version
):
v2.4.3 h1:Y1FaV2N4WO3rBqxSYA8UZsZTQdN+PwcoOcAiZTM8C0I=
2. How I run Caddy:
Running caddy as a caddy user (everything works except when I put logging directive in) on alpine. Using xcaddy to build with custom DNS modules. I can see that the file logging module (writer) is in, but when I put the logging directives in Caddyfile, the validator barfs.
a. System environment:
Linux web01 5.10.59-0-virt #1-Alpine SMP Mon, 16 Aug 2021 09:59:55 +0000 x86_64 Linux
b. Command:
caddy validate
c. Service/unit/compose file:
#!/sbin/openrc-run
supervisor=supervise-daemon
name="Caddy web server"
description="Fast, multi-platform web server with automatic HTTPS"
description_checkconfig="Check configuration"
description_reload="Reload configuration without downtime"
: ${caddy_opts:="--config /etc/caddy/Caddyfile --adapter caddyfile"}
command=/usr/sbin/caddy
command_args="run $caddy_opts"
command_user=caddy:caddy
extra_commands="checkconfig"
extra_started_commands="reload"
depend() {
need net localmount
after firewall
}
checkconfig() {
ebegin "Checking configuration for $name"
su ${command_user%:*} -s /bin/sh -c "$command validate $caddy_opts"
eend $?
}
reload() {
ebegin "Reloading $name"
su ${command_user%:*} -s /bin/sh -c "$command reload $caddy_opts"
eend $?
}
stop_pre() {
if [ "$RC_CMD" = restart ]; then
checkconfig || return $?
fi
}
d. My complete Caddyfile or JSON config:
Paste config here, replacing this text.
Use `caddy fmt` to make it readable.
DO NOT REDACT anything except credentials.
LEAVE DOMAIN NAMES INTACT.
Make sure the backticks stay on their own lines.
apps.gocloud.sh {
root * /www
file_server {
precompressed zstd br gzip
}
tls thomas@munn.me
}
log {
output file /home/caddy/logs/caddy.log {
roll_size 100m
roll_keep 7
roll_keep_for 720
}
}
### 3. The problem I'm having:
<!-- What are you trying to do, and what isn't working? Please describe the issue thoroughly enough so that anyone can reproduce the exact behavior you're seeing. Be as specific as possible. DO NOT USE WEB BROWSERS; use "curl -v" instead. -->
The error I get is `validate: adapting config using caddyfile: Caddyfile:9: unrecognized directive: output`
I can't add the logging directive, even though the logging modules seem to be loaded. No matter what I do can't get the logs to work. Caddy modules lists the following:
### 4. Error messages and/or full log output:
<!-- Please **DO NOT REDACT** any information except credentials. Leave domain names intact! -->
<!-- Please **DO NOT POST TRUNCATED LOG LINES** as systemd is notorious for this. -->
<!-- Please **DO NOT USE WEB BROWSERS.** Use curl -v instead. -->
<!-- Please **DO ENABLE DEBUG MODE FIRST** by adding "debug" to the global options of your Caddyfile. -->
Since my caddyfile is invalid, I won't get debug outputs, but its here:
validate: adapting config using caddyfile: Caddyfile:9: unrecognized directive: output
### 5. What I already tried:
<!-- Show us what effort you've put in to solving the problem. Be specific -- people are volunteering their time to help you! Low effort posts are not likely to get good answers! -->
I followed the pages in wiki, added directives as asked, and logging module is either not loaded or won't load.
### 6. Links to relevant resources: