使用goaccess解析caddy的访问日志
安装最新版 GoAccess(最新版才支持CADDY的日志解析)
$ wget -O - https://deb.goaccess.io/gnugpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/goaccess.gpg >/dev/null
$ echo "deb [signed-by=/usr/share/keyrings/goaccess.gpg arch=$(dpkg --print-architecture)] https://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/goaccess.list
$ sudo apt-get update
$ sudo apt-get install goaccess
修改 CaddyFile 日志相关指令
log {
format json
output file /var/log/caddy/access.log
}
// goaccess只支持caddy的json日志格式
使用以下命令即可查看caddy的访问日志
goaccess /var/log/caddy/access.log --log-format=CADDY
以上为Debian 11系统环境