< Saving Map Context as an URL

Developer Manual >

30. CartoWeb and WMS Usage Statistics [plugin] (statsReports)

StatsReports plugin allows to visualize statistics on CartoWeb and WMS usage. Results can be shown in a form of tables, charts or maps.

30.1. Import and Reports

Statistics are generated out of CartoWeb's Accounting plugin output or out of Apache logs (for WMS statistics). A Java application proccesses the logs and stores raw data in a PostGreSQL database.

30.1.1. How To Build?

Source of Java application are located in scripts/stats. To build this project, you need:

  • Maven 2 (http://maven.apache.org)
  • Java Runtime Environment JRE >= 1.5
  • A PostgreSQL database

The other external librairies are taken care of by Maven.

Now you must set STATS_DB environment variable. On Linux it will look like:

export STATS_DB="jdbc:postgresql://localhost/MYDB?user=MYUSER&password=MYPASSWORD"

This is needed by post-build automatic tests. Then simply run following build command:

mvn clean install

30.1.2. Running Import

CartoWeb logs are imported using the following command (remove end-of-line backslashes on Windows):

java -Xmx1G \
     -cp target/stats-standalone.jar org.cartoweb.stats.imports.Import \
     --initialize --tableName=stats \
     --db="jdbc:postgresql://localhost/MYDB?user=MYUSER&password=MYPASSWORD" \