Venturing into the World of Linux, Open Source, 3D Printing, and Tinkering.

Using GoAccess to analyze Caddy logs

2023-10-10 Blog GoAccess 412Linux

I was looking for a tool to analyze the Caddy logs for this blog. I ran across a Reddit comment suggesting GoAccess. I have outlined my setup experience using the tool. Overall, I have found the tool to be informative with a well done presentation of data.

Setup Logging in Caddy

If you haven’t already done so, access login will need to be enabled on the server. I found this article to be helpful. The following example below is a basic configuration for access logs. You may find additional configuration is required to ensure sensitive information is removed from the log. There are additional examples provided in the previous article.

log {
	output file /var/log/access.log {
		roll_size 1gb
		roll_keep 5
		roll_keep_for 720h

Installing GoAccess

The Download page for GoAccess provides multiple installation methods. I chose to use the official GoAccess Debian/Ubuntu repository. This will ensure the latest build is installed. I did attempt to utilize the version (1.5.5) in the Ubuntu apt repository. However, I ran into an issue that was fixed in a later version. At the time of this post, I found version 1.8 to work with Caddy without issue.

Using GoAccess

Once the components have been installed, the final task is to use tool. The command below will bring up a realtime terminal based output of the log analysis. Note, depending on your configuration sudo privileges may be required. The getting started page provides additional examples for utilizing the tool such exporting the information to to a HTML file.

goaccess /var/log/caddy/access.log  --log-format=CADDY


Mastodon Discussion post