Safeguard
Security Guides•

What should an online store log so it can investigate an incident?

When something goes wrong at checkout, logs answer who did what. Which store events to record, which data to keep out of logs and how long to look back.

Safeguard Security Team
3 min read

An online store should log sign ins, admin changes, access to sensitive data, payment and refund actions, plugin or app changes and failed requests, while keeping card numbers and secrets out of the logs. The goal is to answer who did what, when and from where.

What OWASP says to record

OWASP's Logging Cheat Sheet says the application itself is the primary source of events, because it knows the user's identity, roles and the context of an action. It lists events worth logging, including actions by privileged users, use of default, shared or break glass accounts, access to sensitive data such as payment cardholder data, creation and deletion of system level objects, data import and export, submission of user generated content, and network connection failures such as TLS certificate validation errors.

A store focused list

AreaEvents to log
AccountsSign in success and failure, password reset, MFA change, new device
AdminNew staff user, role change, plugin or app install and removal, theme publish
OrdersPrice override, manual discount, refund, order edit after payment
DataCustomer or order exports, bulk API reads, report downloads
IntegrationsAPI key creation, webhook failures, signature check failures
ContentReviews or messages rejected by a filter

What to keep out

Do not log full card numbers, card verification codes, passwords, session tokens or secret keys. Logs are copied around and read by many tools, so a secret in a log line becomes widely exposed. Record references, such as an order ID or the last few digits where policy allows, rather than the sensitive value.

Steps to put this in place

  1. Pick a central place for logs outside the web server, so an attacker who gains the server cannot easily erase them.
  2. Use consistent fields: time with timezone, user or key, source address, action, target and result.
  3. Turn on the platform's activity or audit log for admin actions.
  4. Set alerts for a short list: a new admin, a bulk export, a burst of failed sign ins, a refund above a limit.
  5. Test by performing a safe action, such as creating a test user on a staging store, then confirm you can find it in the logs.
  6. Decide retention with your legal and finance contacts, and write it down.

Why it pays off

During an incident, the first question is usually whether customer data was touched. Without logs, the honest answer is that you do not know, and that tends to force the widest possible notification. Good logs let you narrow it.

Quick check

Is logging the full request body a good idea?

Usually not. It may capture passwords or card data. Log the fields you need and mask the rest.

Who should review the logs?

Assign a named person or team, and rely on alerts for the short list of events that need a fast response.

Sources

Safeguard provides compliance and evidence automation that can help you keep records of controls, with a free scan at gold.safeguard.sh/scan.

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.