how to use GoAccess with Caddy


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 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
  }
}

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=CADDY