To configure basic access logging in Caddy, first configure the default logger in the global options:
{
log {
output file /var/log/caddy/access.log
format console
}
}
then, in your site configuration, add the log
directive to each site you want to log:
mydomain.tld {
log
}
By default, logs are rotated as follows:
- Log files are rotated once they reach 100 MB
- Rotated files are automatically compressed with gzip
- Old log files are removed when either:
- They are older than 90 days, or
- There are more than 10 newer log files