
GoAccess is a powerful tool for log analysis, and installing it is a straightforward process. You can download the binary from the official website.
First, you'll need to install the required dependencies, which include libcurl and libssl. These libraries are essential for GoAccess to function properly.
Once you've downloaded the binary, you can extract it to a directory of your choice. This will give you access to the GoAccess executable.
To configure GoAccess, you'll need to create a configuration file. This file will contain settings for your log file, including the location and format.
What Is It?
GoAccess is an open source real-time web log analyzer and interactive viewer that runs in a terminal on *nix systems or through your browser.
It's a tool that provides fast and valuable HTTP statistics for system administrators who need a visual server report on the fly.
GoAccess can be accessed at https://goaccess.io for more information.
GoAccess parses the specified web log file and outputs the data to the X terminal.
Installation
You can install GoAccess on your system using the official Ubuntu repository or by compiling it from the source.
To install GoAccess from the Ubuntu repository, you'll need to add the GoAccess repository to your system. This can be done by downloading and adding the GPG key and then updating the repository cache.
Alternatively, you can install GoAccess by compiling it from the source. This requires installing the necessary dependencies, downloading the GoAccess source, and then configuring it.
If you're using Rocky Linux 8, you'll need to compile GoAccess from the source as it's not included in the default repository. You can download the latest version of GoAccess using wget, extract the downloaded file, and then compile it.
You may also need to install apt-transport-https to access the official GoAccess Debian & Ubuntu repository.
Here are the steps to install GoAccess from the Ubuntu repository:
- Download and add the GPG key
- Add the GoAccess repository
- Update the repository cache
- Install GoAccess
Or, if you prefer to compile GoAccess from the source, here are the steps:
- Install necessary dependencies
- Download the GoAccess source
- Extract the downloaded file
- Configure GoAccess
- Verify the installed version of GoAccess
Installation Methods
You can install GoAccess on your system using two main methods: from the Ubuntu repository or by compiling it from the source.
To install GoAccess from the Ubuntu repository, you'll need to add the GoAccess repository to your system. This involves downloading and adding the GPG key.
You can also install GoAccess by compiling it from the source, which requires installing the necessary dependencies first.
To download the GoAccess source, you'll need to use the command that fetches the source code from the repository.
Extracting the downloaded file is the next step, which you can do using a command that unrar or unzip the file.
Once extracted, you can change the directory to the extracted directory and configure GoAccess using a specific command.
After the installation is complete, you can verify the installed version of GoAccess using a command that displays the installed version.
The default configuration file for GoAccess can be found using a command that lists the configuration files.
You can also compile GoAccess using a command that downloads, extracts, and compiles the software.
Intriguing read: Open Source Website Analytics
Configuring GoAccess
To configure GoAccess, you'll need to familiarize yourself with the command line options and configuration file. See the options that can be supplied to the command or specified in the configuration file, keeping in mind that long options need to be used without prepending --.
To configure websites for monitoring, GoAccess works by scanning the logs of your HTTP server. This means you need to ensure the log configuration of the HTTP server is OK. For Apache, you can achieve one logfile per virtual host using the CustomLog command.
To match the Apache configuration, you'll need to uncomment specific lines in the GoAccess configuration file. The main configuration file is located at /usr/local/etc/goaccess/goaccess.conf, where most options are commented out.
To enable and disable some recommended options, you'll need to edit this file and change the corresponding lines.
Run
To run GoAccess, you'll need to specify the Apache log file. This file keeps a record of all incoming HTTP traffic.
You can analyze and monitor the Apache logs using the GoAccess command. The output will display a user-friendly interface.
In this interface, you should see the Apache logs, including a range of valuable metrics. These metrics include unique visitors per day and requested files (URLs).
Here's a list of what you can expect to see in the GoAccess interface:
- Unique visitors per day
- Requested Files (URLs)
- Static Requests
- Not Found URLs (404s)
- Visitor Hostnames and IPs
- Operating Systems
- Browsers
- Time Distribution
- Virtual Hosts
Storage and Automation
You can automate the process of updating stats with GoAccess, and schedule it to run hourly using cron.
To keep your stats updated, you'll need to automate the process of generating a new report on a regular basis.
Just add a line to your cron job, changing the path according to your setup, and you're good to go.
Having GoAccess generate a new report on a regular basis will keep your stats up to date and accurate.
With Tokyo Cabinet storage support, GoAccess can keep its own database, giving it a memory of its own.
This means you can run GoAccess with persistent logs, and it will be able to display statistics on a longer period, not just a short period like one day.
See what others are reading: New Relic Session Replay
Automate Stat Updates
You can automate stat updates with GoAccess by scheduling it to run hourly with cron. This way, you'll have up-to-date statistics on a regular basis.
To automate the process, you'll need to add a line to your cron job that runs GoAccess with the necessary options. This will ensure that your statistics are always current.
Here's a simple way to do it:
By using these options, you can automate the process of updating your statistics and ensure that your data is always up-to-date.
Choose Storage Location
You can store the output of GoAccess in various locations, depending on your preferences.
One option is to put the report at the root of your website, for example, website1, and access it by connecting to the address http://www.website1.com/goaccess.html or similar.
You could also have a dedicated directory for all your statistics, as I do, where you put the result. My Apache server serves a default page located in /srv/www/default when someone connects to my bare domain name.
A sub-directory named goaccess is a simple solution to store the result, and it's easy to access the stats by connecting to the address, for example, http://www.mydomain.com/goaccess.
Frequently Asked Questions
Is GoAccess free?
Yes, GoAccess is completely free to use, being an open-source utility. This means you can access its features without any cost or licensing fees.
What is the default port of GoAccess?
The default port of GoAccess is 7890. You may need to specify the WebSocket server location using --ws-url if your access log is not on your local machine.
Sources
- https://github.com/allinurl/goaccess
- https://www.howtoforge.com/tutorial/ubuntu-goaccess-apache-log-analyzer/
- https://arnaudr.io/2016/09/16/setting-up-goaccess-to-analyse-apache-logs/
- https://www.digitalocean.com/community/tutorials/how-to-install-and-use-goaccess-web-log-analyzer-on-ubuntu-20-04
- https://www.atlantic.net/dedicated-server-hosting/how-to-install-goaccess-web-log-analyzer-on-rocky-linux-8/
Featured Images: pexels.com