The amount of traffic your server receives is an important metric for any system administrator to watch. There are tools that show you easy-to-read graphs compiled using your web server’s access log, which simplifies this process.
Use your log files
Each time someone accesses your web server, a new row entry is created in your web server’s access log. Usually, the client’s IP address and the request made by the client are logged, along with the response code, date and time of access, and other information about the request.
Manually browsing the log files would be a pain, but there is software that can use your log files to monitor the health of your server in real time. GoAccess is a popular open source tool for this use case. It can run in a terminal and display useful statistics based on your log entries. It can track the total number of visits per day and which pages get the most traffic.
GoAccess also provides a web interface, if you prefer to access it that way. This interface provides much more detailed information, as well as real-time graphics to track each visit. Visitors with the same IP address, same date and same agent can be grouped into unique visitors.
GoAccess is completely free and open source. It is intended to be used for a single web server; if you have multiple web servers you might want to consider a log management tool, otherwise you will have multiple instances of GoAccess running on each server.
You can also use a order like
apachetop, or Nginx State Module if you just want to know the traffic you are getting. If you are concerned about the CPU or memory usage of your web servers, you can watch this with Monit, another open source tool.
You can install GoAccess from your distribution’s package manager. For Debian based systems like Ubuntu this would be:
apt-get install goaccess
You can also download and compile from source if you want.
Next, you’ll want to locate the primary access log for your web server. It is usually in
/var/log/. For Apache this should be
/var/log/apache2/access.log, and for Nginx this should be
/var/log/nginx/access.log. You can use
tail to preview the ends of these log files.
Next, you’ll want to run GoAccess and pass it the location of the log file:
You will be prompted to select a log file format; “Common Log Format” should work for Apache and Nginx.
Then you can view your access statistics from the command line.
If you want to use the real-time web interface, you can run it using the following command:
goaccess /var/log/nginx/access.log -o /var/www/html/report.html --log-format=COMMON --real-time-html
This will produce an HTML page and run a WebSocket server to receive updates. You may want put this page behind basic authentication, but it will be accessible from anywhere by your web server if you place it in the root of your document (usually
If you want more data, install an Analytics suite
Log files are great, but they can’t tell you everything. They are best used when you need accurate, real-time reports of raw inbound and outbound traffic. If you have a second to spare for more data, you can use an analysis suite.
You will probably want to install Google analytics it does not matter, because its use is completely free. You just include the
tag in the header of your site, and every visit to your site will report to Google. It provides simple pageviews, bounce rate, and session tracking, as well as demographic information and in-depth summaries on how users are using your site.
Google Analytics also supports basic A / B testing, which can be used to improve your website design and help you achieve your goals more often.