how to use GoAccess with Caddy

dec 26 2021


GoAccess is a simple and lightweight tool for viewing webserver access log files; it can subsitute a lot of the things that you'd normally need something like Google Analytics for. however, Caddy does not create logs compatible with GoAccess by default. luckily, this is an easy Caddyfile change.

/etc/caddy/Caddyfile
example.com {
  root * /var/www
  file_server
  log {
    output file /var/log/caddy/access.log
    format single_field common_log
  }
}

once you add the log directive to your Caddyfile, simply run GoAccess, and you'll get a nice way to view the logs in your terminal.

#!/bin/bash
goaccess /var/log/caddy/access.log --log-format=COMMON