WordPress activity logs are a website administrator must have. The are helpful when troubleshooting a technical issue, trying to identify a hack attack or during forensic work. They also allow business owners to monitor users productivity and improve user accountability. Logs are an important security and admin tool that allow you to know exactly what happens on your WordPress websites and multisite networks.
In this article we explain why you should segregate the WordPress activity log data from your WordPress website database and how you can do it.
Where do plugins store the WordPress activity logs?
WP Security Audit Log saves the activity log in the WordPress database, like all other plugins. Some plugins store the logs in the WordPress’ settings table wp_options, and some others store it in separate tables. The WP Security Audit Log plugin stores the activity logs in two separate tables in the WordPress databases. Refer to the WordPress activity logs database documentation for more details of how exactly the logs are stored and in which tables.
Why should you segregate the activity log from the WordPress database?
The most obvious reason that comes to mind is performance improvement. For every user change on the website WordPress writes the change to the database and also to the log. So even though users do not notice any performance degradation, there are more database writes happening.
If you are using WP Security Audit Log you should not worry about performance. The plugin is highly optimized to not affect the performance of a website. Also, such change is not necessary on small websites.
However, on very busy websites with thousands of users, especially on multisite networks, this change might be required. So by segregating the WordPress activity logs to an external database you improve the database’s performance.
Better WordPress security
Segregation of data, roles etc is a security best practise. This applies to logs as well. The log data cannot be tempered with if it is segregated from the main database. This means that if your website is hacked, you can still use the logs for forensic work.
Availability is a very important benefit of segregating the logs. Imagine this, a website has technical issues and cannot be reached. In such case the logs are also inaccessible, making it impossible to troubleshoot an issue.
However, if the troubled website’s logs are in an external database you can use the WP Security Audit Log on another website to access the logs.
Easier to restrict access to the activity logs
Only people of trust should have access to the WordPress activity logs. By default only administrators can access the activity logs in the WP Security Audit Log plugin, and you can change these activity log privileges.
However, if for example developers have direct access to the WordPress database, they can access the logs directly from within the database. By segregating the logs from the WordPress database even users with direct database access cannot read them.
Meet regulatory compliance requirement
PCI DSS, GDPR, HIPAA, ISO 27001 and the other regulatory compliance standards require you to keep a log of all changes that happen on your website. Most of them also require you to:
- Restrict access to the WordPress activity logs on a need to know basis,
- Segregate the activity logs from the WordPress website database (be it a database or source code files).
Save on hosting and admin expenses
WP Security Audit Log stores the activity logs in the WordPress database in a very optimized way. Therefore the WordPress activity logs do not require a lot of hard disk space. However, the size of the data depends on how busy your website is and on your requirements.
If you have hundreds of users working on the website, they might generate a lot of data. Keeping old activity log data also requires some space. For example this is a requirement for financial institutions. They are required by law to keep at least 6 years of activity logs.
Web hosting is more expensive than simple database storage space. Should you require additional space, store the activity logs in an external database on a database hosting package. These packages cost much less and have less admin overheads than a web hosting package.
How to store the WordPress activity logs in an external database
You can store the WordPress activity logs in an external database with the WP Security Audit Log Premium plugin. All you have to do do is:
- Configure a database connection in the plugin,
- Configure the plugin to write the activity logs to the external database,
- Migrate the activity log data that is on your WordPress database to the new external database (optional).
This process is explained in more detail in how to store the WordPress activity logs in an external database.
Archiving old activity log data
In case you need to keep years of activity log data, you should also use the archiving feature. With this you can archive old activity log data to a separate archive database. Archiving also have a few benefits. For example the main activity log database remains fast. Also, since since it has less data, it is much easier to search the data.
For more information on the activity logs and how to manage them, refer to the best practices for managing WordPress activity logs.