Home Blog WordPress Management How to track & monitor WordPress database changes
How to track and monitor wordpress database changes

How to track & monitor WordPress database changes

Did you know that you can track and monitor changes that occur within your WordPress’ site database? This is not only helpful for troubleshooting issues, it is also vital to the security of your WordPress site as well as ensuring data integrity and compliance.

This post explains how to monitor WordPress database changes, as well as the types of alerts you can receive whenever something has changed. But first, let’s learn more about the benefits of monitoring WordPress databases.

What are the benefits of monitoring WordPress databases closely?

There are a ton of benefits to keeping track of database changes in WordPress. Some of these include:

  • Enhanced security by allowing you to detect unauthorized changes and potential hacks

  • Helps ensure compliance with regulations and frameworks, like GDPR and PCI DSS

  • Ensures data integrity by monitoring for accidental overwrites, deletions or data corruption

  • Easier troubleshooting of technical issues by showing you what changes occurred in the past

How to start monitoring database changes in WordPress

The most practical way for most people to track database changes on their WordPress site is by using a plugin. There are plenty of options, some of which we’ll cover in this section.

The first is our own plugin, WP Activity Log. Obviously, we stand behind our tools, so couldn’t help but discuss it first. But it’s also the number one user rated activity logging plugin in WordPress, covering database changes as well as various other changes made on your WordPress site.

There’s both a free and a paid version depending on the features you need, so you’re free to choose the version that’s right for your needs.

To get started, simply:

Step 1. Select whether to go for free, premium or enterprise

Step 2. A. If you chose the free version, simply search for “WP Activity Log” in the plugins tab after logging into WordPress (Plugins > Add New Plugin), and click on Install Now.

If you chose Premium or Enterprise, then you can purchase the plugin here on our website. After your purchase, you’re sent an email with instructions on how to download and install the plugin. 

Step 3. Now, all that’s left to do is configure the plugin for your needs. Follow the steps laid out in our getting started guide, and you’re all set up to start tracking database changes!

WP Activity Log not only keeps track of changes in the WordPress database, but it also keeps a record of user and system changes. 

Other options

Other options include Query Monitor and Stream. These are both less extensive than a full-blown activity log, but they do offer decent database monitoring and are also both actively being worked on by developers. 

You can find out more about these solutions on their respective WordPress.org pages, including the features they offer as well as setup instructions. 

What type of WordPress database changes does WP Activity Log keep a log of?

WP Activity Log tracks a ton of changes, not just database changes either. However, in this post, we will focus only on the database changes the plugin can keep a log of. Refer to the list of activity log event IDs for a complete list of all the changes it logs.

Below are the various event IDs the plugin uses to keep a log of WordPress database changes.

Database changes caused by WordPress plugins

The below is a list of event IDs the plugin uses to keep a log of database changes done by plugins on a WordPress website:

  • 5010: A plugin created a number of tables in the database

  • 5011: A plugin modified the structure of some tables in the database

  • 5012: A plugin deleted a number of tables from the database

Below is a screenshot of some of these events in the WordPress activity log.

Database changes caused by WordPress themes

Below is a list of event IDs the plugin uses to keep a log of database changes done by themes on a WordPress website:

  • 5013: A theme created a number of tables in the database

  • 5014: A theme modified the structure of some tables in the database

  • 5015: A theme deleted a number of tables from the database

Database changes caused by other components:

There are cases in which the plugin detects changes in the database but cannot determine the source of the change. In such cases, the plugin still keeps a log of the change. However, it does not report the object making the change. Below are the event IDs it uses to keep a log of such changes.

  • 5016: An unknown component created a number of tables in the database

  • 5017: An unknown component modified the structure of some tables in the database

  • 5018: An unknown component deleted a number of tables from the database

How to get notified of WordPress database changes via email and SMS

Database changes are not very common on a WordPress website. So when they happen, it is important that you are aware of them. Sometimes a database change can be a mistake, an unauthorized change, or even worse, done by a hacker. So the earlier you are notified of a change, the easier it is to reverse it if required.

To get instant notifications of all database changes recorded in the activity log, you can configure an email and/or SMS notification. Do keep in mind that SMS notifications require a Twilio subscription. SMS delivery charges may apply. Thankfully, this can be set up with just a few clicks. Here is how:

1. Navigate to Notifications > Custom Notifications in the plugin menu.

2. Click Create custom notification to create a new notification.

3. Enter a title.

4. Add the following rule: OBJECT IS EQUAL DATABASE. This means that whenever the Object of an event in the activity log is database, this notification is triggered. Refer to the list of activity log objects and event types for more detailed information on this metadata.

5. Enter the email address and/or phone number and save the notification.

That is it. Now you will receive an email and SMS notification whenever there is a database change event in the WordPress activity log.

Getting notified of some specific WordPress database changes

If you do not want to be notified of all database changes, but only when some specific event IDs are logged, you can do so by specifying the event IDs in the notification trigger. Here is how:

1. Navigate to the Notifications > Custom Notifications in the plugin menu.

2. Click Create custom notification to create a new notification trigger.

3. Enter a title 

4. Configure the following criterion: EVENT ID IS EQUAL 5010.

5. To add more event IDs, click the Add rule button and enter the Event IDs you want to be notified of. Make sure you set the condition to OR to be notified when either event happens.

6. Specify the email address and/or mobile phone number that you would like to receive the notifications on.

7. Click on Save Notifications.

Tracking WordPress database changes – It’s necessary!

Tracking database changes will help you keep your website secure and ensures you comply with important regulations like GDPR and PCI DSS. 

Hopefully, this post has helped you set up database monitoring, as well as set up some alerts so you’re always aware of major changes that might impact your business negatively.

FIELD:
Brenda Barron Avatar