< Templating

Locate Plugin >

18. Accounting

CartoWeb provides a mechanism to store accounting informations. These informations can be used to generate statistics of the application usage.

18.1. Accounting Configuration

18.1.1. Introduction

Accounting configuration specifies if the accounting is enabled or not, and how to store the accounting information. The configuration is the same for the client or server. Notice however that if you are using CartoWeb in direct mode, the server accounting configuration is not taken into account. See Section 4.2, “ client.ini for more information about direct mode.

When you enable accounting, you also need to activate the accounting plugin in your configuration. This is done through the loadPlugins parameter of client.ini and mapInfo.loadPlugins of your server_conf/<mapId>/<mapId>.ini file.

18.1.2. client.ini or server.ini

Here are the options that can be set on the client or server:

  • accountingOn (boolean: 'true'|'false'): sets whether accounting is enable or not.
  • accountingStorage (string: 'file'|'db'|'db_direct'): controls how the accounting information is stored. file means that accounting information will be stored in files named cartoweb3/www-data/accounting/<MAP_ID>/{client|server}_accounting.log where <MAP_ID> is the mapId currently used. db means that accounting information is stored inside a database table. This table can be created using the following command:
    CREATE TABLE cw_accounting (date timestamp, info text);
    The database to be used can be configured using the accountingDsn parameter. See next item. db_direct the information is stored inside a database table. Unlike db the data are not inserted in an unique columns but are directly splited.


    This mode can only be used if this client and the server are in direct mode. See Section 4.2, “ client.ini for more information about direct mode.

  • accountingBasePath (string): Optional base path where to store the accounting log files. This is only used when accountingStorage is set to file.
  • accountingDsn (string): DSN (Data Source Name), used to specify which database to use for storing accounting information. This is only used when accountingStorage is set to db or db_direct.


Do not forget to enable the accounting plugin if you want to use this feature.

18.2. Managing Accounting Information

18.2.1. Accounting Log Files Administration

Accounting log file are used to store one line of accounting information each time a request is made on CartoWeb. The log files will grow with time, as more and more data are stored inside. This means that special care has to be taken by the CartoWeb administrator to avoid that the log file eats all the available free disk space.

It exists several tools which can be used to manage the log files and to avoid it takes too much place. For instance the Logrotate software can be used to rotate the log files regularly.


Activating accounting and not taking care of log file management can slow down or interrupt CartoWeb good working if the log file becomes too large.

valid xhtml 1.0 valid css