Recover statistics from legal logs


If you migrate your server or if you have loosing your statistics data, you can recover statistics using the dedicated command-line tool.
Recover statistics is by command-line because using the Web console have currently some limitations to upload big files and provide importation status.

  • with Artiva v3.07.051500 or above, the tool is already installed.
  • for old 2.x, 3.x versions, you can download it here: import-access-logs.zip
    • Extract this file
    • Put it inside the /usr/share/artica-postfix directory using WinSCP.
You can display help by typing
 /usr/share/artica-postfix/import-access-logs.py --help

This tool is designed to import legal logs to a temporary table called ‘import_table
After importing data in this table, you will be able to export data from this table in the working table called ‘access_log’ to generates graphs and charts trough Artica.

  • Enable the SSH access trough the Artica Web Console.
  • Using putty program connect to the server
  1. Init the temporary table by using the -j
  2. Import all files using switchs (–gzpath,–gzfile,–path,–file) – use ‘-z’ if you want to resolve categories
  3. Merge the temporary table to the access_log table using the -m switch
  4. Empty the temporary table to free space using the -j switch
  5. Compress and index database using the command-line:
    • /usr/local/ArticaStats/bin/vacuumdb -f -z -v -h /var/run/ArticaStats --dbname=proxydb --username=ArticaStats

For example, we want to import the legal logs and resolve categories too for each website:

/home/logrotate_backup/proxy/2017/03/04/proxy-003.touzeau.biz.2017-03-04_00-01-06--2017-03-06_23-59-02.gz
cd /usr/share/artica-postfix
 python import-access-logs.py -j
 python import-access-logs.py -z --gzfile=/home/logrotate_backup/proxy/2017/03/04/proxy-003.touzeau.biz.2017-03-04_00-01-06--2017-03-06_23-59-02.gz
 python import-access-logs.py -m
 python import-access-logs.py -j
/usr/local/ArticaStats/bin/vacuumdb -f -z -v -h /var/run/ArticaStats --dbname=proxydb --username=ArticaStats

Leave a comment