I spent some time making a pretty colored log format that maybe you might like to use as well.
This uses the transform
encoder plugin:
Place this in your Caddyfile’s global options:
{
log http.log.access {
include http.log.access
output file /var/log/caddy/access.log
format transform "e[35m[{ts}]e[0m e[96me[1m{request>remote_ip}e[0m e[31m{request>headers>X-Forwarded-For}e[0m e[33m{request>method}e[0m e[92m{request>host}e[32m{request>uri}e[0m e[97m{status}e[0m e[90m{request>headers>User-Agent}e[0m e[34m{request>headers>Referer}e[0m" {
time_format "02/Jan/2006:15:04:05-0700"
}
}
log {
exclude http.log.access
output file /var/log/caddy/caddy.log
format json
}
}
Edit: the forum is replacing the ANSI escape codes with the letter e
>:(
So here’s a gist 53244678f5290978d19a75ce0f7e0bf6/gistfile1.txt at master - 53244678f5290978d19a75ce0f7e0bf6 - gitea.moe
It looks like this