How to Installing GoAccess on a Centos 7?
Installing GoAccess on a Centos 7 server
GoAccess offers real-time analytics for web server access logs and is a potent open-source log analyzer and interactive web log viewer. It is a useful tool for server administrators, developers, and digital marketers since it provides a straightforward and user-friendly interface for tracking and analyzing website traffic. In this post, we’ll walk you through installing GoAccess on a CentOS 7 server so you can learn crucial information about the traffic to your website.
Introduction
Understanding visitor behaviour, spotting patterns, and improving web server performance all depend on website analytics. GoAccess streamlines this procedure by offering a real-time examination of the access logs on your server. On your CentOS 7 server, GoAccess may be installed so that you can create thorough reports, display data, and learn useful information about the traffic to your website.
Understanding GoAccess
GoAccess makes use of the log files produced by web servers like Nginx and Apache. It analyzes these logs and produces dynamic HTML reports, enabling you to keep track of important indicators like the number of unique visitors, the most popular pages, referring websites, geographic information, and more. With GoAccess, you can rapidly see traffic peaks, discover possible security risks, and make well-informed choices to enhance the functionality of your website.
Benefits of Installing GoAccess on a Centos 7 Server
Adding GoAccess to your CentOS 7 server has the following advantages:
- Real-time Monitoring: GoAccess gives you real-time information on the traffic to your website, enabling you to respond quickly to any problems or abnormalities.
- In-depth reports: The tool creates reports that are in-depth and provide helpful insights into visitor behaviour, popular URLs, bandwidth use, and other important data.
- GoAccess is a user-friendly online interface that is dynamic and straightforward, making it simple to investigate the produced reports.
- Options for Customization: You may alter the reports to meet your needs, allowing you to concentrate on certain data points or eliminate superfluous data.
- GoAccess is meant to be resource-friendly, having little effect on server performance. It is lightweight and efficient.
Let’s now go through the installation of GoAccess on a CentOS 7 server step by step.
Prerequisites for Installing GoAccess
Before proceeding with the installation, ensure that you have the following prerequisites:
- A CentOS 7 server with root access or a user with sudo privileges.
- A web server (Apache or Nginx) is installed and running on your CentOS 7 server.
- Basic knowledge of the command line interface.
Step 1: Updating the System
On your CentOS 7 server, updating the system packages comes first. Run the following command on your server by opening a terminal or connecting through SSH:
sudo yum update
This command will upgrade any out-of-date packages on your system and update the package repository.
Step 2: Installing Dependencies
For proper operation, GoAccess depends on some other components. Use the following command to install these dependencies:
sudo yum install ncurses-devel GeoIP-devel libmaxminddb-devel
The command will fetch and install the necessary packages.
Step 3: Downloading GoAccess
Downloading the GoAccess source code is the next step. Go to the “Downloads” section on the official GoAccess website (https://goaccess.io/). Copy the URL for the most recent stable version.
Use the following command to download GoAccess once you are back on your server:
wget [GoAccess Download URL]
Replace [GoAccess Download URL] with the link you copied.
Step 4: Compiling and Installing GoAccess
Once you’ve downloaded the source code, you must install and build GoAccess. Execute these commands:
tar xzvf goaccess-[version].tar.gz cd goaccess-[version]/ ./configure --enable-utf8 make sudo make install
[version] should be changed to the precise version number you downloaded.
It can take a little while for the compilation and installation procedure to be finished.
Step 5: Configuring GoAccess
Once GoAccess is installed, you need to configure it to analyze your server’s access logs. Create a configuration file using the following command:
sudo nano /etc/goaccess.conf
You may set the location to the log file, the date format, the output format, and more in the configuration file. Change the options to suit your needs, then save the file.
Step 6: Running GoAccess
With the configuration file in place, you can now run GoAccess and start analyzing your logs. Use the following command:
sudo goaccess -c /etc/goaccess.conf -a -o /var/www/html/report.html
This command runs GoAccess with the specified configuration file, generates the report, and saves it as report.html in the /var/www/html directory.
You can access the report by visiting http://<your-server-IP>/report.html in a web browser.
Using GoAccess with Apache
To use GoAccess with Apache, you need to enable the Apache log format. Open the Apache configuration file using a text editor:
sudo nano /etc/httpd/conf/httpd.conf
Add the following at the end of the line that begins with LogFormat:
"%h %^[%d:%t %^] \"%r\" %s %b \"%R\" \"%u\""
For the modifications to take effect, save the file and restart Apache:
sudo systemctl restart httpd
Now, GoAccess ought to be able to decipher and evaluate Apache logs.
Using GoAccess with Nginx
You must change Nginx’s settings if you’re using it as your web server if you want to log data correctly. Using a text editor, open the Nginx configuration file:
sudo nano /etc/nginx/nginx.conf
Add the following line after the http block:
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent"';
For the modifications to take effect, save the file and restart Nginx:
sudo systemctl restart nginx
Now, GoAccess ought to be able to decipher and evaluate Nginx logs.
Customizing GoAccess Reports
GoAccess provides a number of customization options so you may cater the reports to your own requirements. To concentrate on pertinent data, you may change the report’s design, activate or disable certain metrics, and use filters.
For comprehensive directions on modifying the report, see the official GoAccess documentation.
Integrating GoAccess with Other Tools
GoAccess provides integration options with popular analytics and monitoring tools. You can export data to external services such as Elasticsearch, AWS S3, or MongoDB, enabling you to consolidate your analytics ecosystem and gain deeper insights into your website’s performance.
Refer to the official GoAccess documentation for instructions on integrating with other tools.
Conclusion
You can unleash the potential of real-time web log analytics by installing GoAccess on your CentOS 7 server. You may make data-driven choices to boost website speed, increase security, and enhance user experience by watching and examining your server’s access logs.
For server administrators, developers, and digital marketers, GoAccess is a useful tool because of its user-friendly interface and many customization possibilities. With GoAccess, you can observe traffic trends, get useful insights, and maintain your website’s performance edge.
FAQs
Can I analyze logs from multiple web servers with GoAccess?
Absolutely. GoAccess supports analyzing logs from multiple web servers simultaneously. You can consolidate logs from Apache, Nginx, and other servers into a single GoAccess report.
Can GoAccess handle large log files?
Yes, GoAccess is designed to handle large log files efficiently. Its performance is optimized to process and analyze logs of considerable size without compromising speed or resource usage.
Does GoAccess provide real-time analytics?
Yes, GoAccess provides real-time analytics by continuously monitoring and updating the reports as new log entries are recorded. You can observe live traffic patterns and make immediate observations.
Is GoAccess suitable for small websites or only larger ones?
GoAccess is suitable for websites of all sizes. Whether you have a small personal blog or a large e-commerce platform, GoAccess can provide valuable insights into your website's traffic and performance.