Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

Privacy & data protectionMixed 24 series

Access logs that survive an audit

An access log is evidence only if it can answer a simple question: who read this record, when, from where, and whether they were allowed.

Quick reference

Who read what, when, why, and were they allowed.

  1. Six fields — Subject, resource, time, decision, reason and source.
  2. Every layer — IdP, application, database, object store and control plane.
  3. Append-only — Separate account, object lock and synced clocks.
  4. A rerunnable query — Saved with parameters, result and policy version.

In one line: Log the decision, not the session. Evidence answers who read which record, and whether that was allowed.

Start this week:

  • Add the resource and the decision to one application's log line.
  • Time the two investigation queries against a month of data.
  • Try to delete an audit object with the application role.

Explained

Most teams log the request line and stop. That proves a session existed. It does not prove which rows were returned, whether the caller was authorised for those rows, or why the access happened. Add the subject, the resource, the decision and the reason, and make the identifiers stable enough to join across systems.

Log at every layer that can say no: the identity provider, the application, the database and the object store. Each layer knows something the others do not. The application knows the purpose, the database knows the rows, and the cloud control plane knows who changed the permission that made the access possible.

Then make the log hard to edit. Write it to a separate account, keep it append-only or under object lock, and set a retention period longer than the longest investigation you expect.

Checklist

Run it against the busiest dataset first, then against the one with the widest access.

Collect

  • Each access record names the subject, resource, time and decision.
  • The reason or purpose is recorded, not inferred later.
  • A request id joins the layers that handled the same access.

Protect

  • The log lives in a separate account from the workload.
  • The application role cannot delete or edit the log.
  • Clocks are synchronised and the offset is monitored.

Query

  • The two investigation queries exist and are timed.
  • Indexes match the queries rather than the write path.
  • A denial can be listed for a period without a full export.

Present

  • The policy version is stored with the result it justified.
  • The pack records who ran the query and when.
  • Known gaps are written down next to the answer.

The field guide

The full guide of the PDF (P1159), page by page.

Six fields, one decision (the fields)

An access log is useful when it answers a question an auditor actually asks. Most logs answer the easy half.

A log with a user id and a timestamp proves that someone was logged in. It does not prove which rows came back, whether the caller was entitled to them, or why the access happened. Add the resource and the decision, and the log becomes evidence.

FieldQuestion it answers
SubjectWho made the request?
ResourceWhich record was read?
TimeWhen, on one clock?
DecisionAllowed or denied?
ReasonUnder which purpose?
SourceFrom where, with which credential?

Log identifiers, not payloads The access log is itself personal data. Recording the request body copies the exposure you are trying to govern, and it turns every log reader into a data controller's problem.

If a field cannot be populated without guessing, leave it out and write down why. A gap that is documented is easier to defend than a value invented by a parser.

A session id is not an answer to who read this record.

Log where the decision is made (the layers)

Each layer knows something the others do not. Collect the decision where it happens, not only where the request enters.

LayerWhat it knows
Identity providerWho authenticated, with which factor
ApplicationWhich object, for which purpose
DatabaseWhich rows the query returned
Object storeWhich key was read or copied
Control planeWho changed the permission

Joining these needs a stable identifier. Use the same subject id and request id across layers, or the investigation becomes a manual matching exercise at the worst possible time.

The permission is the context An access allowed because someone granted a broad role is a finding about the role, not about the reader. Keep the policy change in the same timeline as the read.

Application logs are the easiest to enrich and the easiest to leak. Log the decision and the identifiers, and keep the payload out of the log line by default.

Log the decision where it is made, and join it on a stable id.

Make it hard to edit (the store)

A log the subject can rewrite is not evidence. Separate the writer from the storage and make the store append-only.

  • Write to a separate account with its own credentials and no delete permission.
  • Turn on object lock or an append-only sink before the first incident.
  • Keep the retention period longer than the longest investigation you expect.
  • Sync clocks, because a timeline built from two clocks is two timelines.

Versioning and object lock on an audit bucket

aws s3api put-bucket-versioning --bucket audit-logs \
  --versioning-configuration Status=Enabled
aws s3api put-object-lock-configuration --bucket audit-logs \
  --object-lock-configuration ObjectLockEnabled=Enabled

Test the delete Try to delete an object from the audit bucket with the application role. A denial is the test passing; a success is the finding you were about to discover in an incident review.

Rotation is not a substitute for retention. A log kept for thirty days answers thirty days of questions, and the interesting question usually covers a quarter.

If the application can delete its own audit log, it is a diary, not evidence.

Answer one question in minutes (the query)

The test of an access log is a query you can run under pressure. Write it before you need it.

Pick the question an investigation starts with: which records did this person read, or who read this record? Both should be a single indexed query, not an export and a spreadsheet.

Who read one customer record

select at, subject, resource, decision, reason
from access_log
where resource = 'customer:8841'
  and at >= now() - interval '30 days'
order by at desc
limit 200;

Index for the question Index on resource and time, and on subject and time. A log you cannot query in the first hour is a log you will still be querying on day three.

QuestionIndex it needs
Who read this record?resource, at
What did this person read?subject, at
What was denied?decision, at

Write the investigation query before the incident, and time it.

The evidence pack (the pack)

When an auditor asks, the answer is a small set of artefacts, not a dashboard link.

  1. State the question and the exact scope: subject, resource and period.
  2. Save the query, the parameters and the result, with a hash of the result.
  3. Attach the policy or role that made the decision, with its version.
  4. Record who ran the query and when, and store it with the result.
  5. Note what the log cannot show, because gaps are evidence too.
ArtefactWhy it matters
The question and scopeLimits what the answer claims
Query and parametersMakes the result reproducible
Policy versionShows the rule that applied
Result hashDetects edits after the fact
Runner and timeShows who answered, and when

Gaps are findings If the retention window is thirty days and the question covers ninety, say so in the pack. An honest gap is easier to defend than a silent one, and it is the first thing a good auditor tests.

An audit answer is a query, a result and the policy behind it.

Keep the pack with the incident or the request it answers, not in a folder called audit. The next person will search by the question, and a folder name is not a question.

Evidence is a query you can rerun, not a screenshot you can describe.

The honest caveat: logging personal data is itself processing. An access log full of request bodies creates the same exposure you are trying to govern, so log identifiers and decisions, not payloads.

Your turn: Could you answer, in minutes, who read one customer's record last month?

More notes: Privacy & data protection

Open in the notes app: search, filters, copy This note on GitHub