Search for answers or browse our knowledge base.
How to store the activity log of multiple sites in 1 central database
The WordPress activity log database tables
The WP Activity Log uses two tables in the database to store the WordPress activity log:
Note: the wp_ in the table name is a prefix. Every table in your WordPress database has the same prefix. Refer to the WP Activity Log database documentation for more details on how the WordPress activity log is stored.
Store the WordPress activity log of multiple WordPress sites in one MySQL database
The 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 activity log of both the websites test1.com and test2.com on the same MySQL database.
- When configuring the External Database on the website wpwhitesecurity.com we specified wpw as prefix.
- When configuring the External DB add-on on wpsecuritybloggers.com we specified wpsb as prefix.
- Once both websites are configured we will have the following the tables in the MySQL database where the activity logs are stored:
- wpw_wsal_metadata and wpw_wsal_occurrences in which the WordPress activity log of wpwhitesecurity.com is stored.
- wpsb_wsal_metadata and wpsb_wsal_metadata wn which the WordPress activity log of wpsecuritybloggers.com is stored.