Logs rotation

How logs rotation works

By default for logs rotation ISPmanager 5 uses the logrotate utility that can be installed in ISPmanager --- Settings--- Software

You need to activate rotation for each web-domain in its edit form. Click "Show hidden fields" for flexible configuration of logs rotation.

Rotate1.png

logrotate is started every day in /etc/cron.daily/logrotate . The configuration file is located in

/etc/logrotate.conf 

Logs rotation settings for each web-domain are located in

/etc/logrotate.d/web/domain.com

By default the following logs settings are active (contents of /etc/logrotate.d/web/domain.com)

#The first line is a template of log-files. 
/var/www/httpd-logs/domain.com.access.log {
        olddir /var/www/user/data/logs #Locate archived files into specified directory
        copytruncate #Create a copy of the original log-file and then reset it. Thus the file won't be deleted. 
        compress #Archive files (gzip is used by default)
        monthly #Rotate once a day/week/month
        prerotate #Similar to postrotate, but the operations will be performed before archiving
                /etc/webanalyzer.d/user/domain.com #Analyze logs
        endscript
}
/var/www/httpd-logs/domain.com.error.log {
        olddir /var/www/user/data/logs
        copytruncate
        compress
        monthly
}

 

Start rotation manually

/usr/sbin/logrotate -d -f <path_to_config_of_required_web_domain>

-d - detailed information -f - rotate in any case (for example, even if logs were rotated totay) Example: if you need to rotate logs only for domain.com , the command will look like

/usr/sbin/logrotate -d -f /etc/logrotate.d/web/domain.com

Possible problems

  • log does not need rotating

Cause - logs have already been rotated. You can modify status in the file

/var/lib/logrotate/status

Or delete this file, but you will have to start rotation for all logs again

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

Logs on control panels v5 are rotated by the built-in mechanism once their size reaches 100 MB

Logs analyzer

ISPmanager 5 supports:

  • awstats
  • webalizer

To install a log analyzer, go to ISPmanager --- Settings--- Software.

You need to activate analyzer for each web-domain in its edit form. Click "Show hidden fields" for flexible configuration of logs rotation.

Rotate2.png

Example with Awstats

Once logs analyzer for the web domain domain.com is activated, the configuration file with rules will be created. Normally it is located in

/etc/awstats/awstats.domain.com.conf

The followings are specified in the file

LogFile="/var/www/httpd-logs/dasha.com.access.log" #location of log for analysis
SiteDomain="dasha.com" #site for analysis
DirData="/var/www/user/data/www/dasha.com/webstat/" #location of statistics after analysis
and others. 

You can view statistics per web-domain in ISPmanager --- Web domains--- select a required domain --- click "Statistics".

Execute the following command for collecting statistics manually

/etc/webanalyzer.d/user/domain.name

or

/usr/bin/perl /usr/lib/cgi-bin/awstats.pl -update -config=domain.com

Possible problems with statistics collection

  • Statistics shows only one unique visitor.

This may happen in case Nginx + Apache are installed. Solution - install mod_rpaf for Apache.

  • All zeros in statistics.

Make sure that the following line in the awstats configuration file for the domain (/etc/awstats/awstats.domain.com.conf) is specified

LogFormat=1

You also make sure log format is combined in the Apache configuration file

CustomLog /var/www/httpd-logs/domain.access.log combined
  • How to exclude my IP address from statistics?

Edit the configuration file /etc/awstats/awstats.domain.com.conf .

SkipHosts="123.123.123.123"
 

Was this answer helpful?

 Print this Article

Also Read

ISPmanager installation guide

Installation from system repository ISPsystem software products 5.15.0 and later can be...

Enabling disk quotas

Enabling disk quotas in ISPmanager To enable disk quotas in ISPmanager, browse to the "Software"...

Software licensing policy

ISPsystem software products v.5 have a new licensing policy. There are two ways for activating...

Alpha-version

The Alpha version of a control panel is the first phase to begin software testing. It...

ISPmanager Web-server configuration

Supported software Currently, ISPmanager supports the following servers: Nginx 1.1.15 and...