How to run an activity log on a WordPress site lawfully: the legal basis, a legitimate interest assessment you can adapt, retention periods, the wording for your privacy notice, and what to do when someone asks for their data to be erased.
An activity log records that a named account did a specific thing at a specific time from a specific IP address. Each of those is personal data when it relates to an identifiable person, and usernames and IP addresses do. This is true whichever plugin produces the log, and equally true of your web server's access log, which most site owners have never thought about.
The consequence is not that logging is forbidden. Article 32 expects you to protect the personal data you hold "appropriately", and you cannot investigate a breach without records. The consequence is that the log needs the same treatment as any other processing: a purpose, a legal basis, a retention period and a line in your privacy notice.
Consent is the wrong basis for security logging. It has to be freely given and withdrawable, and an administrator who could withdraw consent to being logged defeats the purpose. Employees can seldom give free consent to their employer in any case.
The usual basis is Article 6(1)(f), legitimate interest. Recital 49 says in terms that processing strictly necessary for network and information security is a legitimate interest. Some organisations can also point to Article 6(1)(c), a legal obligation, where a sector rule requires audit trails. For most WordPress sites, legitimate interest is the honest answer.
Legitimate interest requires a three-part test, and regulators expect to see it written down. It need not be long. Here is one you can adapt:
We record administrative actions on our website (sign-ins, changes to accounts, settings, plugins and content) to detect unauthorised access, investigate incidents and resolve disputes about who made a change.
WordPress does not record these actions. Without a log we could not establish what happened after a compromise or meet our duty to assess and report a breach. We record administrative users only, not visitors, and we do not record page views or content of communications.
The people affected are staff and contractors acting in a professional role, who are told the log exists. The data is limited to username, IP address, time and the change made. It is kept for [period], readable by [roles] only, and not used for performance evaluation. We consider the impact on them low and our interest in security to outweigh it.
If you could not truthfully write the last paragraph, change the logging until you can. Using a security log to measure how hard people work is a different purpose and needs its own assessment, and in several countries its own agreement with staff representatives.
A security audit log has no business recording anonymous visitors.
Recording every page an editor views is surveillance, and it buries the events that matter.
Decide whether you need the full address. A truncated address, with the last part zeroed, still shows that a sign-in came from an unexpected network. A keyed hash still shows that two events came from the same place. Full addresses are justified where you rely on them to detect unfamiliar sign-ins.
A log of settings changes must never store API keys, passwords or payment credentials. Check what your tool does when a gateway setting changes.
"As long as necessary" is the rule, and necessity differs by record. A single period for everything is either too long for the noisy records or too short for the valuable ones.
| Kind of event | Typical period | Reasoning to record |
|---|---|---|
| Failed logins | 30 to 90 days | High volume. Useful for spotting an attack in progress, little value afterwards. |
| Successful logins | 6 to 12 months | Compromises are often discovered months later; you need to see when an account was first misused. |
| Accounts, roles, settings, plugins | 12 to 24 months | Low volume, high value in any investigation or dispute. |
| Content edits | 3 to 12 months | Revisions already hold the content history; the log adds attribution. |
| Orders and refunds | As your accounting rules require | These overlap with financial records, which have statutory periods of their own. |
These are starting points, not law. Sector rules can require longer; PCI DSS, for instance, asks for twelve months. Whatever you choose, make the deletion automatic. A retention period that depends on someone remembering is not one.
Articles 13 and 14 require you to say what you process and why. For a log this is two short pieces of writing.
"When you sign in to our website's administration area, we record your username, IP address and the changes you make, for security and to investigate incidents (legitimate interest, Art. 6(1)(f) GDPR). These records are kept for up to twelve months and are accessible only to our administrators."
To staff and contractors directly, when they receive their login. One paragraph in the onboarding note is enough.
If the people logged are employees, check national employment law before switching anything on. Article 88 allows member states to add rules, and several have. In Germany a works council generally has a say over technical systems capable of monitoring staff. In France staff representatives must be informed and consulted. Where monitoring is systematic, your supervisory authority's list may also call for a data protection impact assessment under Article 35.
A person can ask for the log entries about them. Provide those entries, and remove other people's data from what you hand over.
Because the basis is legitimate interest, people can object. You may continue if you have compelling grounds that override their interests, and security of the system usually qualifies. Reply, and keep a note of your reasoning.
This is where logs get damaged. A request does not automatically succeed: the right applies when the data is no longer necessary, and Article 17(3)(e) exempts data needed to establish, exercise or defend legal claims.
If you do erase, think about what the entry was evidence of. "Administrator A deleted user B" is B's data and also the record of A's action. The sound approach is to redact B's identifying fields and keep the row, so that the accountability record for A survives. Deleting whole rows punches holes in the history that you cannot later explain.
WordPress has built-in tools for both, under Tools → Export Personal Data and Erase Personal Data. Check that your logging plugin registers with them; otherwise the log is silently left out of every request you process.
The steps above apply to any audit log. If you use the plugin this site is about, the settings map directly: four IP storage modes including masking and hashing, retention per event family, registration with WordPress's export and erasure tools, erasure by redaction so the hash chain stays valid, and a separate capability for reading the log. The GDPR overview goes through them, and the plugin is free on WordPress.org.