How Can I Store the WordPress Audit Trail from Multiple Websites in 1 Central Database

You are here:
Back to KB search

This step by step guide explains how you can use the External database integration tool to store the WordPress activity log (audit trail) of multiple WordPress websites on a single MySQL database.

The WordPress Audit Log Database Tables

The WP Security Audit Log uses two tables in the database to store the WordPress activity log:

  • wp_wsal_metadata
  • wp_wsal_occurrrences

Note: the wp_ in the table name is a prefix. Every table in your WordPress database has the same prefix. Refer to the WP Security Audit Log database documentation for more details on how the WordPress audit trail is stored.

Store the WordPress Activity Log of Multiple WordPress Websites in One MySQL Database

Storing multiple WordPress audit trails from different websites in one central databaseThe concept for this is very simple – when configuring the plugin to store the activity log in the same external database where the activity logs of other sites are stored, specify a different tables prefix for each website.

The other option would be to enable the setting Use the website URL as table prefix when configuring an external database connection so the unique URL of a website is used as a prefix, thus ensuring there are no conflicting table names.

Following is an example of how to store the WordPress audit trial of both the websites and on the same MySQL database.

  1. When configuring the External Database on the website we specified wpw as prefix.
  2. When configuring the External DB add-on on we specified wpsb as prefix.
  3. Once both websites are configured we will have the following the tables in the MySQL database where the audit logs are stored:
  • wpw_wsal_metadata and wpw_wsal_occurrences in which the WordPress audit trail of is stored.
  • wpsb_wsal_metadata and wpsb_wsal_metadata wn which the WordPress audit trail of is stored.