What is goaccess?
According to the website,
GoAccess is an open source real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser.
It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly.
Basically, GoAccess is a powerful, real-time web log analyzer that provides insightful visual reports for your server logs.
If you’re using XCloud, a managed cloud hosting platform, integrating GoAccess can help you monitor and analyze your website traffic efficiently.
In this guide, we’ll walk you through the process of setting up GoAccess in XCloud.
Prerequisites
Before diving into the setup, ensure you have the following:
- An xCloud account: You need access to an xCloud server where your website is hosted.
- SSH access: Ensure you have SSH access to your xCloud server.
- Basic command-line knowledge: Familiarity with terminal commands will be helpful.
How do I install it?
For this example, I am using an Ubuntu 24 server connected to xCloud. The server is using nginx.
Simply visit “xCloud Server Management > Commands > Run Custom Command”.
Then run the following command to install goaccess:
apt update && apt install goaccess -y
Now goaccess should be installed in your server.
Next, we will generate the report using all of our nginx access log files and place the generated report in the /var/www/html/
directory.
Let’s run another command:
goaccess /var/log/nginx/*access.log* --log-format=combined -o /var/www/html/report.html
That’s all. You can now visit the following address to view the report:
http://<your-server-ip>/report.html
For example:
Adding a custom cron job
Now we can add a custom cron job so that the report gets generated automatically.
Visit “Server Management > Custom Cron Jobs > Add Cron Job”:
Add the following value in the command section:
goaccess /var/log/nginx/*access.log* --log-format=combined -o /var/www/html/report.html
And that’s it! The report will be generated according to the interval you set automatically.
Important Note
I would recommend not to do this in a production system. This may reveal your server info to unwanted visitors. However, for R&D and learning, this can be a great task.
How do I remove it?
To remove the report, simple run the following command:
rm -f /var/www/html/report.html
And then delete the custom cron job you just added from the xCloud interface.
It is as simple as that! Did you notice that we did not have to access a terminal? We were able to do everything from the xCloud interface. How cool is that!
Conclusion
By following these steps, you’ve successfully set up GoAccess on your XCloud server. This tool provides valuable insights into your website’s traffic, helping you make data-driven decisions to optimize performance.
Whether you’re monitoring real-time traffic or analyzing historical data, GoAccess is an indispensable tool for any web administrator.
Leave a Reply
You must be logged in to post a comment.