1. Caddy version (caddy version
):
2.3.0
2. How I run Caddy:
run as system daemon at startup by the Ubuntu Server systemctl enable function using a simple Caddyfile entry
a. System environment:
Ubuntu 20.04 Server on AWS, (5.4.0) using PHP 7.4-fpm
b. Command:
systemctl [start/restart] caddy
c. Service/unit/compose file:
????
d. My complete Caddyfile or JSON config:
# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace the line below with your
# domain name.
train.zambia.discon3.org {
root * /var/www/html/zambiatrain/webpages
php_fastcgi unix//run/php/php7.4-fpm.sock
file_server
log {
output file /var/log/caddy/train-info {
roll_size 5MiB
roll_keep_for 720h
}
format json
level INFO
}
}
stage.zambia.discon3.org {
root * /var/www/html/zambiastage/webpages
php_fastcgi unix//run/php/php7.4-fpm.sock
file_server
log {
output file /var/log/caddy/stage-info {
roll_size 5MiB
roll_keep_for 720h
}
format json
level INFO
}
}
zambia.discon3.org {
root * /var/www/html/zambiaprod/webpages
php_fastcgi unix//run/php/php7.4-fpm.sock
file_server
log {
output file /var/log/caddy/prod-info {
roll_size 5MiB
roll_keep_for 720h
}
format json
level INFO
}
}
3. The problem Iām having:
Iām trying to build multiple log files per āserverā entry. With different criteria. I tried putting two log clauses in the config, it added the logs to the json but only assigned the second of the two log clauses to the server.
(the documentation says ālots of log files are goodā, but how?)
4. Error messages and/or full log output:
It only outputs the second log entry (ok, the file above has only 1 entry, as I had to back it down, the earlier log entry was the same, except it had level: error and a file name with error in it.
5. What I already tried:
I had tried:
train.zambia.discon3.org {
root * /var/www/html/zambiatrain/webpages
php_fastcgi unix//run/php/php7.4-fpm.sock
file_server
log {
output file /var/log/caddy/train-info {
roll_size 5MiB
roll_keep_for 720h
}
format json
level INFO
}
log {
output file /var/log/caddy/train-error {
roll_size 5MiB
roll_keep_for 720h
}
format json
level ERROR
}
}
but this just chose only the ERROR variant to log, but the JSON showed it did parse and create both log clauses.
6. Links to relevant resources:
??