Home Blog WordPress Management Activity logs size, database & storage: busting the most common misconceptions

Activity Log storage busting the most common misconceptions

Activity logs size, database & storage: busting the most common misconceptions

If you operate a WordPress website, you’ll be well aware that there can be a lot happening at once. Even more on a multisite network! For that reason, you need an activity log plugin to track all website users activity.

Everyone agrees that activity logs are necessary to successfully manage and run a multi user WordPress site. However, since activity logs are stored in the WordPress database, when site owners learn that, misconceptions start to creep in – what if I do not have enough space to keep an activity log? What if they bloat my database?

This article busts those misconceptions. It explains precisely how activity logs and storage interact with each other. We’ll also show you how to archive old activity logs, delete old activity logs you no longer need, and move them to an external database for storage.

How are activity logs stored on WordPress websites?

Before we dive into what you can do to optimize your activity logs and get the best out of the space you have available, we first must understand how they are stored in a database. The WP Activity Log plugin stores the activity log in two tables in the WordPress database. These are:

  • wp_wsal_metadata
  • wp_wsal_occurrences

These tables and the way the data is stored is optimized for efficiency. So these tables do not really grow much, and they do not have any impact on the overall performance of your WordPress website. You shouldn’t be worried about your WordPress database size or HDD space on your server. If you’d like to learn more about the technical details, refer to the activity log database documentation.

Do activity logs have to be stored on the WordPress database?

No, they don’t. Many users of activity log plugins wrongly assume that activity logs have to be stored on the WordPress database. You do not need to use the WordPress database if you don’t want to. You can choose to store the activity logs in an external database instead.

Why storing activity logs on an external database is beneficial

First and foremost, by storing your activity logs in an external database, you ensure that all the resources available to your WordPress site database are strictly used for the operation of the website, and nothing else. This also safeguards the logs’ integrity in the unfortunate event of a successful hacking attempt or security compromise.

For many businesses, it helps you to meet your regulatory requirements. Many website owners have to comply with PCI DSS, GDPR, HIPAA, and ISO standards. All of these require website owners to segregate activity log data from the website server.

The WP Activity Log plugin allows you to make sure your WordPress adheres to the specific compliance guidelines. It  enables you to store the activity log in an external database and also server if you want.

What determines the storage size of the activity logs?

When assessing the relationship between activity logs and storage, it’s essential to understand that several different factors affect their overall size. The first and most significant contributing factor is how many users are on your website and what do they do. It goes without saying that if you’re operating a busy multi-user site, there’s going to be more activity and more logs.

Another influence on the storage footprint of activity logs is how long you want to keep them for. Obviously, the longer you keep activity logs stored on the database, the more influence it will have on storage requirements.

Can you delete old activity logs?

Of course you can. Many webmasters are under the impression that activity logs are left to pile up in the WordPress database. But the reality is entirely different.

For example by default, the WP Activity Log plugin deletes logs that are older than 6 months. However, you can choose to keep the logs for a longer period of time, by configuring the activity log retention policies.

Deletion is not an option for some websites due to record-keeping requirements for the compliance bodies mentioned above. For example financial institutions in the EU have to keep the logs for at least 8 years. If that’s the case for your business, archiving onto another database and server is the solution.

How to manage the activity log storage

To show you how easy it is to reduce the resource footprint that webmasters often (we think wrongly) complain about with activity log plugins, it’s worth running through how to achieve those changes with WP Activity Log.

Configuring WP Activity Log retention policies

As highlighted above, the length of time you wish to keep your activity logs depends mostly on your business requirements. However, if you want to change the duration for which records are held in WP Activity Log, there’s a simple process.

  1. Click on the WP Activity Log > Settings from within the WordPress dashboard.
  2. Then click on the Activity Log tab from within the settings menu.
  3. Here, you’ve got two choices:
    1. Select Keep all data – this means that no retention period will be configured. In this case the activity logs are kept indefinitely. In such case you can then archive them on a different server/database.
    2. Or select Delete events older than – this option deletes events that are older than the retention period you configure. You can specify the number of months or years to suit your particular requirements.

Refer to configuring activity log retention policies for more detailed information on this subject.

Storing activity logs on an external database with WP Activity Log

As explained, there are many advantages to storing the logs on an external database/server. With WP Activity Log, you can set this up in three simple steps. Make sure to set up your external database first, and have the information at hand before opening the WP Activity Log plugin.

Setting up the connection to an external database

  1. Click on the DB/Archive/Mirror node in the plugin menu.
  2. Click the Connections tab, followed by the Create a Connection button to launch the connection setup wizard.
  3. Select MySQL Database from the type of connection drop-down menu in the first step of the wizard.
  4. Complete the rest of the setup wizard with the requested information regarding the external database. Finish by choosing a name for your connection.

Configuring the plugin to write the logs to an external database

  1. Click on the DB/Archive/Mirror in the plugin menu.
  2. This time, click on the External Storage tab.
  3. Select the newly-created connection from the Connection drop-down menu.
  4. Enable the option Use Buffer so that the state of connection of the external database does not affect the uptime of the website.
  5. Click the Save & Test Changes to save the new external database configuration and test it.

Migrating the activity logs from the WordPress database to your external database

That’s it in terms of setup! From now on, the WordPress activity log will be stored on the external database. However, the existing activity logs stay put. If you want to migrate those over to your external database too, all you have to do to is:

  1. Return to the External Storage tab of the DB/Archive/Mirror plugin menu.
  2. Click the Migrate Event to External Storage button.
  3. That’s it!

Refer to the guide storing activity logs in an external database for more details about this.

Setting up automatic archiving of activity logs

In case you need to keep the data for years, you should archive the old activity log data. For example you can keep data that is up to one year old in the main activity log database, and move any data that is older than that in an archiving database. To setup this you need to:

  1. Click on the DB/Archive/Mirror node in the plugin menu.
  2. Click on the Archiving tab.
  3. Select the newly-configured external database connection you want to use for the archiving from the Connection drop-down menu.
  4. Configure how old events should be for them to be archived from the Archiving Options settings.
  5. Configure the activity log data retention period in the Activity Log Retention setting.
  6. Specify how often the plugin should run the archiving process from the Run archiving process every drop-down menu.

It’s significant to note that the retention period should be longer than the archiving period. Otherwise, the events will end up purged instead. For example, if you archive after 12 months, the retention policy should be set to 13 months as a minimum.

Refer to the guide archiving the WordPress activity log data for more details about this.

Activity Logs don’t cause the storage problems you might think they do

Hopefully, we’ve proven beyond all doubt that activity logs don’t cause the storage and performance issues with which they are incorrectly associated. With WP Activity Log you don’t even require the activity logs to leave any database footprint if you don’t want them to. There’s certainly no need to worry about databases or HDD storage. If you’d like to learn more on how to manage and maintain the activity log data, refer to our article best practices for managing WordPress activity log data.

Activity-tracking plugins perform an essential role in busy multi-user sites, providing a crucial additional security layer, employee metrics, and an audit trail for compliance purposes.

Get WP Activity Log and start keeping a record of what happens on your websites today.

Posted inWordPress Management
Gina Lucia

Gina Lucia is a freelance writer and regular contributor to the WP White Security blog. She specialises in WordPress website optimisation, ecommerce and B2B writing. When not working, she can typically be found tending to her vegetable garden or travelling to mainland Europe.


Leave a Reply

Your email address will not be published. Required fields are marked *

Stay in the loop

Subscribe to the Melapress newsletter and receive curated WordPress management and security tips and content.

Newsletter icon

It’s free and you can unsubscribe whenever you want. Check our blog for a taste.

Envelope icon
newsletter-pop-up