Online now · reply within 30 min · Mon–Fri 8 am–8 pm Central Time
// INCIDENT RESPONSE · EVIDENCE

Preserve your WordPress logs before you clean. The window is already closing

The evidence that shows how your site was hacked is being deleted right now, on a schedule, by your hosting provider. Most plans discard access logs every 7 to 30 days. Here is the three-line email that stops it, and what each log can actually prove.

9 min readUpdated November 2026MexicoWordPress · WordPress since 2012

When you find out your WordPress site was compromised, the instinct is to clean it immediately. That instinct is understandable, and acting on it first is the single most common reason a company ends up unable to answer the only question that matters later: what happened, and what did they take?

This is not an argument against cleaning. It is an argument about order. Cleaning takes an hour. The evidence takes minutes to preserve and is impossible to recover once it is gone.

Why the cleanup is the wrong first move

A cleanup removes exactly the artifacts that document the intrusion:

  • File modification times. The timestamp on an injected PHP file tells you when it was placed. Delete the file and that timestamp is gone.
  • Accounts the attacker created. A user named admin_support created six days ago is a finding. Delete it and you cannot show it existed or what role it had.
  • Database state. Injected options, modified posts, spam entries. A cleanup overwrites them.
  • Log entries. Not deleted by the cleanup itself, but the cleanup consumes the hours during which they were still available, and it often triggers a host-side action that rotates them.

Restoring a backup is worse than cleaning. A restore replaces the entire state of the incident with a state where the incident does not exist. It also usually restores the vulnerable plugin that let the attacker in, which is why restored sites get hacked again.

The distinction that matters

Making the site safe and establishing what happened are two different jobs. They can both be done. They have to be done in the right order, and the first one destroys the inputs of the second.

The rotation window, by log type

Server logs are not kept forever. Hosting providers rotate them on a schedule to save disk space, and the old ones are discarded, not archived. Past that point they do not become expensive to retrieve. They cease to exist.

Log typeTypical retentionWhat it establishes
Web access log7 to 30 daysWhich IP requested which file, when, and with what HTTP result. The primary evidence source.
FTP / SFTP log7 to 30 daysFile uploads outside the WordPress admin. Often how the first backdoor arrived.
Control panel log7 to 30 daysLogins to the hosting panel, database access, file manager activity.
Database query logOften off by defaultBulk reads against user or customer tables. Rarely enabled on shared plans.
Mail log7 to 30 daysWhether the compromised site was used to send spam or phishing.
WordPress audit logOnly if a plugin was loggingAdmin logins, plugin installs, user creation. Nothing exists retroactively.

The practical consequence: if you are reading this a week after the incident, some of the window has already closed. If you are reading it a month later, on a basic plan, most of it has.

The email to send your host

Send this before you do anything else. Before you call a developer, before you run a scanner, before you restore anything. It costs nothing and it does not commit you to any course of action.

Email to your hosting provider
Subject: Log preservation request - [yourdomain.com]Hello,There is an ongoing security incident on the domain [yourdomain.com].I request that you preserve and DO NOT rotate the following logs for the last 30 days, until further notice:- Web server access logs and error logs - FTP and SFTP transfer logs - Control panel access logs - Database query logs, if enabled - Mail logsPlease confirm in writing that preservation is in place, and provide copies of the above for the period [start date] to [end date].Thank you, [Name] - [Account / customer ID]

Three things make this email work better:

  • Name the account or customer ID. Support queues move faster when the agent does not have to look you up.
  • Ask for written confirmation. "We will look into it" is not preservation. You want a reply that says the logs are held.
  • Ask for copies, not just preservation. A copy in your possession survives a later support mistake, a plan downgrade or a migration.
If the host says they cannot

Some shared plans genuinely do not retain logs that long, and some providers will not export them without a formal request. Ask anyway, in writing, and keep the reply. A documented refusal is itself relevant later: it establishes that the evidence was unavailable and why.

What each log actually proves

Preserving everything is right, but it helps to know what you are looking for, because it changes what you ask the host for if they push back on scope.

01

Access log: the entry point

A sequence of requests to a plugin file, followed by a successful POST, followed by requests to a file that should not exist. That pattern is the intrusion. Without the access log you can find the backdoor but not how it arrived.

02

Access log: the exfiltration question

Unusually large responses, repeated requests to export endpoints, or admin-ajax calls with suspicious parameters. This is how you assess whether data left, rather than guessing.

03

FTP log: the first foothold

If credentials were stolen rather than a plugin exploited, the upload appears here and not in WordPress. Sites cleaned only at the WordPress layer get reinfected because this vector was never examined.

04

Panel log: scope beyond WordPress

Panel access means the attacker may have reached other sites on the account, mailboxes or databases. WordPress-only analysis would miss it entirely.

05

Mail log: whether you were the sender

A compromised site used for phishing creates a different liability question than one used for SEO spam. The mail log is what distinguishes them.

Four more things to preserve

Logs are the perishable part. These are less urgent but still worth capturing before the cleanup, because a cleanup or a well-meaning developer tends to tidy them away.

  • A full file copy, including the suspicious files. Not a WordPress export. The actual wp-content tree, with timestamps intact, plus wp-config.php.
  • A database dump as it stands. Including the rogue users, the injected options and the spam rows. This is the state you want to be able to show later.
  • The user list and the plugin list. Screenshots are fine. Names, roles, last login where available, and plugin versions. An abandoned plugin at version 2.1 is a finding.
  • Whatever alerted you. The Google Search Console notice, the host's malware email, the client's screenshot. It fixes the discovery date, which is rarely the intrusion date.
Hash the copies if a claim is possible

If there is any chance of an insurance claim or a dispute, record a SHA-256 hash of each archive at the moment you create it, and note who created it and when. That is what lets a third party verify later that the copy was not altered. It takes one command and it is the difference between a folder of files and evidence.

If you already cleaned it

This is common and it is not necessarily the end. Some artifacts survive a cleanup, particularly ones held outside the site:

  • Host-side logs are independent of your files. If they have not rotated, they are still there. Send the email now.
  • Post revisions may retain injected content even after the visible post was cleaned.
  • Backups taken before the cleanup may contain the compromised state. Check the dates carefully: a backup from during the incident is evidence, a backup from before it is not.
  • The host's own malware scan report may list the files it found, even if they are now gone.

What you cannot recover is anything that only existed in the live state and was overwritten, and any log window that has already rotated. An honest assessment tells you which of those applies before you spend money on analysis. We do that as part of forensic analysis, and we will tell you when the answer is that there is not enough left to reconstruct.

The order that works

01

Preserve

Send the email. Take the file and database copies. Record hashes. Do not change the site yet.

02

Contain, without destroying

If the site is actively harming visitors, take it offline or serve a maintenance page rather than deleting files. Containment and destruction are not the same operation.

03

Analyze on the copy

Work on the frozen copy, never on the live scene. Find the entry point, the timeline and the persistence mechanisms.

04

Clean and close the vector

Now clean, patch the component that was exploited, rotate every credential and salt, and remove what nobody maintains.

05

Verify and document

Confirm the site is clean, request the Google review if it was flagged, and write down what happened while the analysis is fresh.

If the site is down or actively serving malware and you need it back today, that is a legitimate reason to prioritize recovery. Say so explicitly to whoever handles it, so the preservation step happens in parallel rather than being skipped. Our malware removal service takes the copy first by default for exactly this reason, and emergency support handles the site-down case.

Questions we get asked

Does asking my host to preserve logs cost anything?

Usually not. It is a support request to suspend rotation on existing files. Some providers charge for exporting large log volumes. Ask for the export scope you need rather than everything, if cost is a concern.

Will preserving logs slow my site down?

No. Retaining existing log files uses disk space, not CPU. It does not change how the site serves requests.

My host says logs are only kept 7 days. Is it worth asking?

Yes, immediately. Seven days may still cover the intrusion. And if it does not, the written reply establishes what was unavailable, which matters if you later have to explain why a finding is limited.

Can I just take a backup instead?

A backup is part of preservation, not a substitute. Most backup plugins exclude server logs entirely, because logs live outside the WordPress installation. You need both: the backup for site state, the host request for logs.

What if nothing was stolen?

Then the analysis establishes that, which is worth having in writing. "We found no evidence of exfiltration, and here is the log coverage that conclusion is based on" is a defensible statement. "Nothing was stolen" without evidence is a guess, and it is the guess companies get punished for when a customer later shows otherwise.

Is this only for big companies?

The trigger is not size, it is whether anyone will ask you what happened. A client asking who is responsible, an insurer, a regulator, a customer whose data was on the site. If any of those is plausible, preserve first. The email takes two minutes.

Related reading
SERVICE

WordPress forensic analysis

When the incident has to survive a legal process: chain of custody, timeline and an expert report.

See the service →
SERVICE

Malware removal and hack recovery

Cleanup that finds the entry point, with evidence preserved first and 30 days of monitoring.

See the service →
ARTICLE

Why cleaned WordPress sites get reinfected

The persistence mechanisms a scanner misses, and why the door matters more than the files.

Read the article →

Not sure whether your incident needs evidence preserved?

Send us the domain and when you noticed. We will tell you what is still recoverable and what is not, before you pay for anything.

MexicoWordPress · Central Time · fluent English · USD invoicing · since 2012.