How to Configure the Redis Logging plugin for Revive Adserver

By default, both plugins (Redis Caching and Redis Logging) use localhost to connect to Redis using separate databases (logging db 0, cache db 1), but the parameters can be changed in the plugin settings screens.

Immediately after being installed, the Redis logging plugin will work in parallel with the regular database logging. This means that statistics are being logging both in the database and in Redis.

Once you’ve checked that statistics get into Redis correctly, and you’re happy with it, you can check the “Disable database logging” plugin setting, and no statistics will be saved to MySQL during delivery anymore.

Maintenance script

A new maintenance script has to be run in order to move the statistics back into the database before the main maintenance script is executed. However, since the script is encoded with SourceGuardian and is locked to specific domains, it cannot be run with php-cli. Below is an example to run it with curl on localhost but specifying the proper hostname, so that:

curl -s -H "Host: your.domain.com" http://127.0.0.1/plugins/apDeliveryLogRedis/scripts/maintenance.php

This has to be setup as a cron job on each individual delivery server, ideally at minute 0 of every hour, as it only processes statistics from the previous hour or before.

Depending on the configuration of the delivery servers, a specific virtual host might be required to run the script, both because the plugins folder isn’t normally accessible for security reasons (by means of a built in .htaccess file), and also because your delivery virtual host might point directly to the www/delivery directory. One thing that might be helpful to know is that SourceGuardian also whitelists the subdomains: e.g. if your licence is linked to example.com, you could set up such a virtual host to be redis-maint.example.com.

After this special maintenance step has completed, the delivery data that was initially logged in Redis will have been written into the traditional bucket tables (to be recognized by data_bkt in their table names). Now you can trigger the normal maintenance to summarize and further process the bucket data so that they become available as statistics.