This tutorial describes you to how to install and use GoAccess on your Linux systems.

Installing GoAccess

Most of the Linux operating systems contains GoAccess packages in their official repositories. So you can simply install it with package manager.

Debian based systems:sudo apt-get update && sudo apt-get install goaccess -y Redhat based systems: yum install goaccess Arch Linux: pacman -S goaccess

For other operating systems visit this page to install Goaccess.

Use GoAccess from Terminal

Choose the log file based on your operating system and web server used. On Debian based systems log are generated under /var/log/apache2 directory and Redhat based system Apache create logs under /var/log/httpd directory. Use -f option to define the log file with goaccess command. Then select the log format. Default Apache log format is COMBINED. The GoAccess also allows you to define the log format with using –log-format command line options. For example, to use COMBINED log format the command will be: You will see the output on system console like below:

Press ‘Q’ to exit out of the GoAccess terminal viewer.

View GoAccess Output in Web Dashboard

GoAccess allows users to generate report in various formats like HTML, JSON and CSV. The HTML format generates a html page with all data in visual format. We can generate the report by using the following command in to a html file. Let’s create a html report file under /var/www/html, which is the default document root set on my Apache server. The following command will generate html report:

-a – Enable a list of user-agents by host -o – Used to define output file Output format is automatically selected based on output filename extension

Next, access report.html using server ip address or domain name.

Slide down to the webpage to display more information.

Auto Update Web Dashboard File

You can schedule goaccess command to update html report on regular interval. Create a shell script with following content: /opt/goaccess.sh:

Then schedule the above script with crontab: Add the following content to end of file Save crontab and close.

Conclusion

In this tutorial, you have learned abount GoAccess utility to view web server logs in visual formats.

GoAccess   A Real Time Apache   Nginx Log Analyzer   TecAdmin - 56GoAccess   A Real Time Apache   Nginx Log Analyzer   TecAdmin - 37GoAccess   A Real Time Apache   Nginx Log Analyzer   TecAdmin - 37