Who Changed It/Guides

WordPress Audit Logging and the GDPR: A Step-by-Step Guide

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.

The short version
  • An audit log is personal data, and security is a recognised legitimate interest for keeping one.
  • The basis only holds if you limit what you log, set a retention period, and tell the people being logged.
  • Erasure requests do not automatically override a security log; decide case by case and record why.
  • Logging employees can trigger employment-law duties on top of the GDPR.
Legal basis Art. 6(1)(f) & Recital 49 Network & information security is a recognised legitimate interest.
Security duty Article 32 GDPR Expects appropriate technical measures to detect and investigate incidents.
Erasure exemption Article 17(3)(e) Records needed to establish or defend legal claims can be retained or redacted.

1. Accept that the log is personal data

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.

3. Write the legitimate interest assessment

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:

Adaptable template · Art. 6(1)(f) LIA
01 / Purpose

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.

02 / Necessity

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.

03 / Balance

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.

4. Minimise what you record

01 · Who
People with a login

A security audit log has no business recording anonymous visitors.

02 · What
Changes, not reading

Recording every page an editor views is surveillance, and it buries the events that matter.

03 · IP addresses
Pick the right precision

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.

04 · Secrets
Never log credentials

A log of settings changes must never store API keys, passwords or payment credentials. Check what your tool does when a gateway setting changes.

5. Set retention per kind of event

"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 eventTypical periodReasoning to record
Failed logins30 to 90 daysHigh volume. Useful for spotting an attack in progress, little value afterwards.
Successful logins6 to 12 monthsCompromises are often discovered months later; you need to see when an account was first misused.
Accounts, roles, settings, plugins12 to 24 monthsLow volume, high value in any investigation or dispute.
Content edits3 to 12 monthsRevisions already hold the content history; the log adds attribution.
Orders and refundsAs your accounting rules requireThese 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.

6. Tell people

Articles 13 and 14 require you to say what you process and why. For a log this is two short pieces of writing.

Privacy notice clause · Art. 13 & 14 GDPR

"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.

7. Handle requests without destroying the record

Article 15
Access

A person can ask for the log entries about them. Provide those entries, and remove other people's data from what you hand over.

Article 21
Objection

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.

Article 17
Erasure (redact, do not delete)

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.

8. Close the loop: processors and records

9. Common questions on WordPress audit logs and the GDPR

Are IP addresses in WordPress security logs considered personal data under the GDPR?
Yes. Both dynamic and static IP addresses are personal data when they can be linked to an individual user account or natural person. You can process them lawfully for network and information security under Article 6(1)(f), or reduce their sensitivity by masking the final octet or storing a keyed hash.
Do I need user or employee consent to run an activity log in WordPress?
No. Consent is unsuitable for security logging because an administrator or attacker could simply withdraw consent before making changes. Rely on legitimate interest (Article 6(1)(f) and Recital 49), document a brief Legitimate Interest Assessment, and inform users in your privacy notice and onboarding notes.
How long should a WordPress activity log be kept for GDPR compliance?
The GDPR does not fix a single number; you must set the shortest period that fulfills your security purpose. A practical split is 30 to 90 days for noisy failed logins, 6 to 12 months for successful logins and content edits, and 12 to 24 months for high-impact changes to accounts, roles, plugins and settings, with automatic pruning enabled.
What happens when a user submits a GDPR Right to Erasure request?
Evaluate whether the records are still needed for security or legal claims under Article 17(3)(e). Where erasure applies, redact the person's identifying fields (username, email, IP) in place rather than deleting entire log rows, so the audit trail of actions performed by or on that account remains unbroken.

Doing this with Who Changed It

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.