Usage Omeka Classic plugin

Purging Old Entries

Entries are kept until they are older than the Retention period setting and a purge runs. Set the period under Plugins > Audit Trail > Configure; the default is 365 days, and 0 keeps entries forever (every purge then does nothing). See Configuration.

A purge runs in one of three ways: from the log page, by itself once a day, or from the command line. Each purge that deletes entries logs it (audit_trail.purge, with the number deleted and how it ran).

From the log page

Only Super Users see this section.

  1. Open Audit Trail in the admin menu and scroll to Retention purge at the bottom of the page.
  2. Click Run purge now.

A background job is started and the message The retention purge job has been queued appears. The job deletes the entries older than the retention period, a thousand at a time, and records how many it deleted.

The job runs through Omeka's background jobs, so it needs the path to PHP's command-line program (background.php.path in application/config/config.ini). If nothing is deleted, see Troubleshooting or use one of the other ways.

By itself, once a day

Tick Purge automatically in the settings. Then, once a day, the first time someone who may view the log opens the dashboard or the log, the entries past the retention period are deleted, up to 10,000 at a time (any more go the next day). Nothing needs scheduling, which suits hosting where you cannot use cron.

From the command line

The script plugins/AuditTrail/bin/purge-audit-log.php starts Omeka itself and deletes old entries directly, without the job queue.

cd /var/www/omeka

# Use the retention period from the settings
php plugins/AuditTrail/bin/purge-audit-log.php

# Delete entries older than 90 days, whatever the setting
php plugins/AuditTrail/bin/purge-audit-log.php --days 90

# Report how many entries would be deleted, without deleting
php plugins/AuditTrail/bin/purge-audit-log.php --dry-run

Run it as a user that can read Omeka's db.ini. Options and exit codes are in CLI Scripts. While logging is turned off, the script does nothing unless given --days.

Scheduling with cron

Run the purge nightly with --quiet, so cron only sends mail when the script fails:

# Purge Audit Trail entries nightly at 02:00
0 2 * * * cd /var/www/omeka && /usr/bin/php plugins/AuditTrail/bin/purge-audit-log.php --quiet

Replace /usr/bin/php with the output of which php, and /var/www/omeka with your Omeka Classic folder. Test the command by hand as the cron user first. To keep a record of each run, drop --quiet and append the output to a file:

0 2 * * * cd /var/www/omeka && /usr/bin/php plugins/AuditTrail/bin/purge-audit-log.php >> /var/log/omeka-audit-purge.log 2>&1

With several Omeka Classic sites on one server, add a line for each.

Log in for Support