GoAccess is an open source realtime web log analyzer and viewer. It use the standard web server log file as source to build a readable graphical HTML output as web page (dashboard) or an overview in the shell.
GoAccess is released under the MIT License
GoAccess is already pre-installed on uberspace. This guide describes how to use it effectively.
After the installation of GoAccess, it is necessary to enable the web server logs and to configure GoAccess with the right log format.
Enable the Web Server Log¶
Please follow the instructions in the uberspace manual to enable the web server logs.
Please consider, after the web server log enabling, it needs some time to have some entries in your new log files. Depends on the web traffic.
Copy the default configuration:
[isabell@stardust ~]$ cp /etc/goaccess/goaccess.conf ~/etc/goaccess.conf
Edit the configuration file and uncomment the following parameters:
# Time Format Options (required) time-format %H:%M:%S # Date Format Options (required) date-format %d/%b/%Y # NCSA Combined Log Format (is in use by Uberspace) log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u" # Set HTML report page title and header. html-report-title My Uberspace
First Try (or Realtime Analysis in the Shell)¶
To get first results, to check that everything is maintained, please enter:
[isabell@stardust ~]$ goaccess --agent-list --config-file ~/etc/goaccess.conf --log-file ~/logs/webserver/access_log
Scroll with your cursor keys up and down. With “q” you can quit GoAccess.
This is the graphical variant as static HTML web page. I consider a new folder inside the html location, that you have access from outside on your statistics.
[isabell@stardust ~]$ mkdir ~/html/statistics [isabell@stardust ~]$
The command to create a static file with GoAccess is:
[isabell@stardust ~]$ goaccess --agent-list --config-file ~/etc/goaccess.conf --log-file ~/logs/webserver/access_log --output ~/html/statistics/report.html
The content of
~/html is publicly accessible. To protect it from unintended visitors, set up HTTP basic authentication using an
To view the statistics, point your browser to your uberspace URL, e.g.
To create a GoAccess file with a cron job every hour as example, a script is helpful. The location and name for the script file is:
#!/bin/bash goaccess --agent-list --config-file ~/etc/goaccess.conf --log-file ~/logs/webserver/access_log --output ~/html/statistics/report.html
Make your script file executable with:
[isabell@stardust ~]$ chmod +x ~/bin/goaccess_generate_statistics.sh [isabell@stardust ~]$
Cron jobs are described in detail in the Uberspace manual. In this case i consider the following task:
[isabell@stardust ~]$ crontab -e [isabell@stardust ~]$
0 * * * * $HOME/bin/goaccess_generate_statistics.sh >/dev/null 2>&1
The actual readable web log file is valid for one day. Uberspace consider a rolling aspect and create archives of the last seven days. With other words, a long term statistics is not possible, otherwise the next script level consider the archives per day too.
Tested with Uberspace 7.3.10 and GoAccess 1.3Written by: FM <firstname.lastname@example.org>