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

Plug-in management

A plug-in is an add-on for a program that adds a specific feature or service to it. For...

Administrator accounts. Technical details. (ISPmanager)

While creating a new administrator account, a new system user with the same name is...

Backup plans

This module can be used you to manage the backup plans to save your server data from an accident...

How to restore data in ISPmanager 5

Data recovery consists of several steps. Input parameters: version includes the data,...

Monitoring

Srvmon Service monitoring is provided by the Srvmon program. The program is normally located in...