قالب وردپرس درنا توس
Home / Tips and Tricks / How to see how many hits your server handles – CloudSavvy IT

How to see how many hits your server handles – CloudSavvy IT



Shutterstock / Andrey VP

The amount of traffic your server receives is an important measure for any system admin to look at. There are tools that show you easy-to-read graphs compiled with your web server̵

7;s access log, making this process easy.

Use your log files

Each time someone accesses your web server, a new line is created in your web server’s access log. The client’s IP address and the request they made are usually logged, as well as the response code, date and time of access and other information about the request.

Manually combing through the log files would be difficult, but there is software that can use your log files to monitor the server’s health in real time. GoAccess is a popular open source tool for this application. It can be run in a terminal and displays useful statistics based on your log entries. It can track total 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 charts that track each individual visit. Visitors with the same IP, date and 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 may want to consider a log management tool, otherwise you have multiple instances of GoAccess running on each server.

Alternatively, you can use a command such as apachetopor Nginx status module if you just want to know how much traffic you are getting. If you are concerned about CPU or memory usage on your web servers, you can monitor it with Monit, another open source tool.

Installing GoAccess

You can install GoAccess from your district’s package manager. For Debian-based systems like Ubuntu it would be:

apt-get install goaccess

You can also download and compile from the source if you wish.

Then you want to find your web server’s primary access log. This is usually in /var/log/. For Apache, it should be /var/log/apache2/access.log, and for Nginx it should be /var/log/nginx/access.log. You can use tail to preview the ends of these log files.

Then you want to run GoAccess and send it to the log file:

goaccess /var/log/nginx/access.log

You are prompted to select a log file format. “Common Log Format” should work for Apache and Nginx.

Then you can see your access statistics from the command line.

If you want to use the web interface in real time, you can run it with the following command:

goaccess /var/log/nginx/access.log -o /var/www/html/report.html --log-format=COMMON --real-time-html

This will output an HTML page and run a WebSocket server to receive updates from. You may want to put this page behind basic authentication, but it will be available anywhere on your web server if you put it in your document root (usually /var/www/html/).

For more data, install an Analytics Suite

Log files are good, but they can not tell everything. They are best used when you need accurate real-time reports on the raw traffic coming in and out. If you have one second left for more data, you can use an analysis package.

You’ll probably want to install Google Analytics regardless, as it’s completely free to use. You simply include

Google Analytics also supports basic A / B testing, which can be used to improve the design of your website and help you achieve your goals more often.


Source link