Skip to content

Instantly share code, notes, and snippets.

@Jiab77
Last active July 17, 2019 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jiab77/fbdb4d8c20243ffd47a19cbeb4a004eb to your computer and use it in GitHub Desktop.
Save Jiab77/fbdb4d8c20243ffd47a19cbeb4a004eb to your computer and use it in GitHub Desktop.
GoAccess install on Ubuntu Server 18.04

GoAccess install on Ubuntu Server 18.04

The default install options are pretty good for standard usage but for advanced one, you need to go to the compilation option...

Compile GoAccess

You will have to install some dependencies first.

sudo apt install libncursesw5-dev libglib2.0-dev libgeoip-dev libtokyocabinet-dev libbz2-dev libssl1.0-dev

Check the latest release here: https://goaccess.io/release-notes then download the required files.

wget https://tar.goaccess.io/goaccess-1.3.tar.gz
tar -xzvf goaccess-1.3.tar.gz
cd goaccess-1.3/
# Change '--enable-tcb' according to your needs (memhash|btree)
./configure --enable-utf8 --enable-geoip=legacy --enable-tcb=btree --with-openssl
# This will use all available cpu cores
# It may fail if 'nproc' is not installed use 'make' only instead
make -j $(nproc)
# Install GoAccess on the system
sudo make install

At the time of this writing the latest version is 1.3.

I'm gonna use btree TCB storage because my devices have low memory, use memhash instead.

See download page for more options and detailed instructions.

Add GoAccess port to the firewall

In order to make the realtime mode working correctly, we need to open the WebSocket port used by GoAccess.

# Add new rule
sudo ufw allow 7890 comment "GoAccess"
# Display active rules
sudo ufw status numbered

I'm using ufw as firewall manager.

Run GoAccess in realtime mode

I'm gonna use the realtime mode only, for other running modes, you will have to read the documentation or at least the Get Started section.

sudo goaccess /var/log/apache2/access.log -a -o /var/www/html/report.html --log-format=COMBINED --real-time-html --html-report-title="GoAccess Report"

You can change the title for something more specific if you prefer.

Use --anonymize-ip to protect visitor IP addresses for example.

It should return and wait with:

WebSocket server ready to accept new client connections

Run GoAccess in standalone mode

If you need to run GoAccess on terminal before run it in realtime mode, you can do it that way:

sudo goaccess /var/log/apache2/access.log -a --log-format=COMBINED

Usefull command line arguments

You can use the following command line arguments to get a better output:

  • --real-os: Display real OS names.
  • --anonymize-ip: Anonymize the client IP address.

Contribute

Feel free to comment here if you have any suggestions or correction to provide! 😄

Contact

You can reach me on Twitter by using @Jiab77.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment