Седат Игдеджи, Sedat Igdeci, Cedat Igdeci, Bekir Igdeci, Lidiya Igdeci, Elizaveta Igdeci

Website statistics

In ISPmanager you can collect statistics of user requests to websites. To do so you can use the following features: 

  • request log — contains the web-server access log; 
  • error log — contains a log of errors encountered for a WWW-domain.

On the WWW-domain add or edit from enable the options Access log and Error log and specify their parameters: 

  1. Enable the log analyzer for the WWW-domain: 
    1. Select an Analyzer.

      Note

      This feature is available provided that Apache and the modules Awstats or Webalizer are installed. Learn more under Web-server configuration.

    2. Select a statistics Period

    3. Select a Report language.

    4. Enable the optionRestrict access to statistics, enter a Password and Confirm it. The login is the name of the WWW-domain owner.  

  2. Error log — specify whether you want to store WWW-server error logs archives and rotate it.

  3. Select a Rotation period.

  4. Store archives —  enter the number of log file archives to be stored on the server. 

 Details

The following strings will be added into the Nginx configuration file for the WWW-domain:

Конфигурационный файл Nginx
access_log /var/www/httpd-logs/<WWW-domain name>.access.log;
error_log /var/www/httpd-logs/<WWW-domain name>.error.log notice;

The following strings will be added into the Apache configuration file for the WWW-domain:

Конфигурационный файл Apache
CustomLog /var/www/httpd-logs/<WWW-domain name>.access.log combined
ErrorLog /var/www/httpd-logs/<WWW-domain name>.error.log

Note

Disk space occupied by the archives is included into the user quota. Learn more under Disk quotas.

To view the log go to Web-server settings→ WWW-logs.

To view the reports go to Domains → WWW-domains→ Statistics. Statistics for a WWW-domains is kept in /var/www/<WWW-domain name>/data/www/<WWW-domain>/webstat.

How it works


Rotation is used to archive the logs so that they occupy less disk space. logrotate is a utility that is used for log rotation. The cron job /etc/cron.daily/logrotate starts the utility every day. 

The rotation global settings are kept in the configuration file /etc/logrotate.conf.

Logrotate configuration file

Rotation parameters of WWW-domains are kept in the configuration files /etc/logrotate.d/web/<WWW-domain name>. E.g.:

Configuration file of the WWW-domain log
/var/www/httpd-logs/<WWW-domain name>.access.log {
        olddir /var/www/<WWW-domain owner>/data/logs
        rotate 65530
        size=16M
        copytruncate
        compress
        <rotation period>
        prerotate
                /etc/webanalyzer.d/<WWW-domain owner>/<WWW-domain name>
        endscript
}
/var/www/httpd-logs/<WWW-domain name>.error.log {
        olddir /var/www/<WWW-domain owner>/data/logs
        copytruncate
        compress
        <rotation period>
}
 Details

olddir— the directory with archived logs.
rotate — the number of archives that will be kept.
size — the maximum size of the file to trigger rotation.
copytruncate — make a log copy and then reset it. The log file won’t be deleted.
compress — file compression file. gzip is used by default.
<roration period>: daily, weekly, monthly.
/etc/webanalyzer.d/<WWW-domain owner>/<WWW-domain> — log analyzer option before rotation.

Run the rotation manually

Execute the command:

/usr/sbin/logrotate -d -f <path to the logrotate configuration file of a WWW-domain>
 Details

-d – display detailed information
-f — force rotation.
<path to thelogrotate configuration file of the WWW-domain> — e.g., “/etc/logrotate.d/web/domain.com”.

Execute the following command to start rotation for all WWW-domains: 

/usr/sbin/logrotate -f /etc/logrotate.conf

The result may be the error “log does not need rotating” meaning that the rotation operation failed as it was already made that day.  To run the rotation change the status of the last rotation for the WWW-domain in the file /var/lib/logrotate/logrotate.status.

Logs analyzer Awstats


Awstats configuration file

Enabling the log analyzer for a WWW-domain creates the configuration file in /etc/awstats/awstats.<WWW-domain>.conf. The main parameters:

  • LogFile — path to the log;
  • SiteDomain — the WWW-domain being analyzed;
  • DirData — path to the directory with results. 

Automatic statistics collection

If you have selected “during rotation” in the Period field the analyzer will start by the logrotate utilityThe following strings will be added into the configuration file /etc/logrotate.d/web/<WWW-domain>:

Configuration file of the WWW-domain log
prerotate 		
        /etc/webanalyzer.d/<WWW-domain owner>/<WWW-domain>

If the Period is “every hour” the statistics collection script will be added into the user cron: 

Cron jobs
# crontab -u username -l
MAILTO=""#
#ISPmanager log rotate <WWW-domain>
0 * *	/etc/webanalyzer.d/<WWW-domain owner>/<WWW-domain>

Start statistics collection manually

Execute the command:

/etc/webanalyzer.d/<WWW-domain owner>/<WWW-domain>
info@mustanhost.com
8.00-20.00
Седат Игдеджи, Sedat Igdeci, Cedat Igdeci, Bekir Igdeci, Lidiya Igdeci, Elizaveta Igdeci