Logs: what to record and how to keep it trustworthy

7 min 5 sections 4 practice questions 6 sources citedISC2 objective 7.2

A ship's officer writes up the log every watch: the time, the position, what happened. Nobody reads it on a calm day, and after a collision it is the first thing anyone asks for. Computer systems keep logs for the same reason. No background is assumed. A security professional decides what is written down, makes sure it cannot be quietly changed, and keeps it for as long as it may be needed.

By the end of this unit you will be able to:

  • Explain what a log entry must contain to be useful
  • Choose which events a system should record
  • Explain why every system must share one clock, and how that is done
  • Name the protections that keep a log trustworthy
  • Tell apart log rotation, retention and preservation

Three clocks and a missing night

An illustrative example

Money is moved out of a secondary school's trip fund one evening. The technician collects the records. The door system says the finance office was entered at 21:14. The finance system says the payment was made at 20:52. The network says someone signed in from the office at 22:03.

Each system keeps its own time, and nobody has ever compared them. The finance server keeps its sign-in records for seven days, and the theft was noticed on the ninth.

What two things about the school's logs have made that evening impossible to reconstruct?

A log is the diary a system keeps

An event is anything that happens on a system and can be observed: a sign-in, a file opened, a setting changed. A log is a record of events, and each line in it is a log entry. Log management is the whole process of generating logs, sending them somewhere safe, storing them, analysing them and finally disposing of them.

Logs serve five purposes: noticing an attack, investigating it afterwards, holding people to account for their actions, finding faults, and showing a regulator or what was done. The run of entries that lets someone reconstruct who did what, in what order, is an audit trail.

An entry is only useful if it answers six questions.

What every log entry should record
QuestionExample
What happenedA sign-in was attempted
When09:14:02 on 3 March
WhereOn the payroll server
From whereFrom the computer at network address 10.2.3.44
With what resultIt failed
WhoThe account j.okafor

What to record, and what to leave out

Recording everything costs storage and buries the entries that matter. The choice follows the . Most organisations start from the same list.

  • Sign-ins and sign-outs, both successful and failed.
  • Every use of privileged rights, and every account created, deleted or given new rights.
  • Reading, changing or deleting sensitive data.
  • Changes to settings, above all to and to security tools.
  • Systems starting, stopping and reporting errors.
  • Alerts and decisions from security tools such as and anti-malware.
  • Network connections allowed and refused.

These arrive from different places. The operating system keeps system and security logs. Each application keeps its own. Firewalls record connections. A proxy, a server that fetches web pages on behalf of users, records the sites visited. Door systems record who entered which room.

Some things must stay out. Passwords, full payment card numbers and more than the purpose needs do not belong in a log. Logs are sensitive records in their own right.

Monitoring staff has legal limits that differ between countries. The usual basis is notice. A sign-in banner tells every user, before they sign in, that activity may be monitored and recorded and that using the system means accepting this. Keystroke monitoring, the recording of every key pressed, is the most intrusive form. It needs a written , legal advice and clear notice.

One clock for every system

An investigation lines up entries from many systems in order of time. If one clock is a minute fast and another two minutes slow, the order is wrong and the story built from it is wrong.

The Network Time Protocol (NTP) is the standard way for computers to set their clocks from a time server across a network. It uses port 123 of the . An organisation runs a few time servers of its own, which take their time from a trusted outside source, and points every other system at them.

Systems in different time zones should record time in one standard. Coordinated Universal Time (UTC) is the world's reference time and is the usual choice. Where a clock cannot be corrected, the difference is measured and written down, so that entries can be adjusted later.

Getting logs off the machine and keeping them unaltered

An intruder who gains administrator rights on a server can erase that server's log. The first protection is therefore to copy each entry, as it is written, to a central log server that the intruder has not reached.

Syslog is the long-established standard for sending log messages across a network. Each message carries a severity from 0 to 7: emergency, alert, critical, error, warning, notice, informational and debug. Traditional syslog travels over UDP on port 514. UDP does not confirm delivery, so messages can be lost. Syslog over Security (TLS), the that protects secure websites, is defined in RFC 5425. It uses port 6514. TCP confirms delivery, and TLS encrypts the messages.

Threats to a log and the protection for each
ThreatProtection
An intruder erases entries on the system attackedSend every entry at once to a central log server
An administrator removes traces of their own actionsHave different people run the log server, and give most users read-only access
A stored log is changed later or each log file, or store it on write-once media
Outsiders read the logRestrict access, and encrypt logs when sent and when stored
The disk fills and logging stopsRotate log files and raise an alert when space runs low
Logging is switched offRaise an alert when a source that normally reports goes quiet

Write-once media can be written a single time and after that only read. A hash proves that a file has not changed since the hash was taken, provided the hash itself is kept somewhere the attacker cannot reach.

Rotation, retention and review

Log rotation
Closing a log file and opening a new one, at a set time or a set size. The closed file is compressed and moved to storage. Rotation keeps files small enough to handle.
Log retention
Keeping logs, as routine, for a period fixed by policy. The period comes from law, regulation, contracts and the organisation's own needs. When it ends the logs are disposed of securely.
Log preservation
Keeping particular logs beyond their normal period because they concern an incident, an investigation or a legal case. Routine deletion of those logs stops.

Intrusions often go unnoticed for months. A retention period shorter than that leaves nothing to investigate.

A log that nobody reads detects nothing. People cannot read millions of entries, so review is done by software that reports what crosses a threshold. A clipping level is such a threshold: events below it are treated as normal and are not reported. Two mistyped passwords are ordinary. Twenty failures on one account in a minute are reported.

A log entry travels from event to archive

A log entry travels from event to archiveEight stages along an axis: an event, the log entry, the central log server reached by syslog, protection, review by thresholds, rotation and retention. The path ends in a fork: disposed of securely, or preserved.Eventa failedsign-inLog entrywrittenwhat, when,who; NTP timeCentral logserverrun bydifferent peopleProtectedhashed,write-onceReviewed bythresholdsclipping level:only above itRotated andretainedkept for thepolicy periodDisposedsecurelywhen retentionendsPreservedfor an incidentor legal casesyslogA log entry travels from event to archiveEight stages along an axis: an event, the log entry, the central log server reached by syslog, protection, review by thresholds, rotation and retention. The path ends in a fork: disposed of securely, or preserved.Eventa failedsign-inLog entrywrittenwhat, when,who; NTP timeCentral logserverrun bydifferent peopleProtectedhashed,write-onceReviewed bythresholdsclipping level:only above itRotated andretainedkept for thepolicy periodDisposedsecurelywhen retentionendsPreservedfor an incidentor legal case
Read this figure as text

The life of one log entry, read left to right. It is written on the system where the event happened, copied at once to a central server out of an intruder's reach, protected, reviewed, and kept for the policy period.

  1. An event happens on a system, such as a failed sign-in.
  2. The system writes a log entry recording what happened, when, and who was involved, with the time taken from a clock set by NTP.
  3. The entry is sent at once by syslog to a central log server run by different people, so an intruder who erases the local log cannot erase this copy.
  4. The stored log is protected: hashed or digitally signed, or kept on write-once media, with access restricted. This is the checkpoint that makes a later change show.
  5. Software reviews the log against thresholds and reports only events above a clipping level.
  6. Log files are rotated, closed at a set time or size, and retained for a period fixed by policy.
  7. When the retention period ends, the log is disposed of securely.
  8. If the log concerns an incident, an investigation or a legal case, it is preserved instead and routine deletion stops.

Common misconception

“Recording every possible event makes an organisation safer.”

Unread logs add cost and hide the entries that matter. Safety comes from recording the right events, protecting them and reviewing them.

Worked example: Putting the school's logs right

The school has a finance server, a door system and a network sign-in service. Their clocks disagree, each keeps its own log, and the finance server overwrites its log after seven days.

  1. Set one clock. All three systems are pointed at the school's time server with NTP, and the technician checks that they now agree to within a second.
  2. Decide what to record. Sign-ins, payments, changes to payees and every use of administrator rights on the finance server are logged, with the six facts in each entry.
  3. Move the logs. Each system sends its entries by syslog, as they are written, to a log server run by the local authority's IT service and not by the school technician.
  4. Set retention. The governors adopt a policy of twelve months, taken from the auditors' requirements. The log server rotates files daily and deletes them at twelve months.
  5. Set review. The log server reports ten or more failed sign-ins on one account in five minutes, and any payment entered outside school hours.

A repeat of that evening would give three records on one clock, held where nobody in the school could alter them, with nine days well inside the retention period.

A question, worked through

An intruder gained administrator rights on an insurance broker's file server. Investigators found that the server's own security log for that night had been cleared. The broker keeps logs only on each server, for 30 days. The security manager is asked which one change would do most to make a future intrusion possible to investigate.

Which change would be MOST effective?

  1. Send each entry at once to a central log server run by another team
  2. Keep the logs on each server for twelve months in place of thirty days
  3. Review each server's security log by hand at the start of every week
  4. Hash each server's log files nightly and store the hashes beside them
Decide on your answer, then open the reasoning
  1. The log did not run out and was not ignored. It was erased by someone who controlled the machine it was stored on. The fix has to put the record beyond that person's reach.
  2. Rule out b. A longer period on the same server gives the intruder twelve months of log to erase.
  3. Rule out c. A weekly reading comes after the event, and there is nothing left to read.
  4. Option d would show that a file had been tampered with, if the hashes survived. They sit on the same server, and a hash cannot bring back erased entries.
  5. Option a copies every entry off the server as it is written, to a system the intruder has not reached and that different people run. It is the most effective change.

Answer: A. Send each entry at once to a central log server run by another team

Choosing between good answers

An intruder or an administrator could alter the log
choose sending it at once to a central log server run by other people, with hashing or write-once storage.
Events from several systems must be put in order
choose time synchronisation with NTP before any analysis tool.
A question asks how long logs are kept
the retention policy decides, from law, regulation and business need. An investigation or legal case preserves the relevant logs beyond it.
Reviewers are swamped by routine entries
choose thresholds such as clipping levels. Do not choose to stop logging.

Check your understanding

4 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.

These questions are drafts that no named reviewer has approved yet.

Question 1 of 4

A log review tool reports an account only after ten failed sign-ins within five minutes. Fewer failures are treated as normal and are not reported.

What is this threshold called?

What to remember

  • Log management covers generating, sending, storing, analysing and disposing of logs.
  • A useful entry says what happened, when, where, from where, with what result and who.
  • All systems take their time from the same source by NTP, or their entries cannot be put in order.
  • Logs are copied at once to a central server run by other people, and protected by hashing, write-once storage and restricted access.
  • Rotation keeps files manageable. Retention keeps them for a set period. Preservation holds them longer for an investigation.
  • A clipping level is a threshold: only events above it are reported for review.

Say it from memory

  1. What does log management have to get right?

    Record sign-ins, privileged actions, access to sensitive data and changes. Each entry says what, when, where, from where, result and who. One clock by NTP. Entries copied at once to a protected central server. Rotation, a set retention period, and preservation for investigations. Review using thresholds.

    Read this part again

  2. What five purposes do logs serve, and what is an audit trail?

    Noticing an attack, investigating it afterwards, holding people to account for their actions, finding faults, and showing a regulator or auditor what was done. An audit trail is the run of entries that lets someone reconstruct who did what, in what order.

    Read this part again

  3. What must stay out of a log, and what gives the usual basis for monitoring staff?

    Passwords, full payment card numbers and more personal data than the purpose needs. The usual basis is notice: a sign-in banner tells every user, before they sign in, that activity may be monitored and recorded and that using the system means accepting this.

    Read this part again

  4. Which protocol and port keep system clocks in step, and which time standard is usually recorded?

    The Network Time Protocol (NTP), on UDP port 123, with every system pointed at the organisation's own time servers. Time is usually recorded in Coordinated Universal Time (UTC). Where a clock cannot be corrected, the difference is measured and written down.

    Read this part again

  5. How do log rotation, log retention and log preservation differ, and what is a clipping level?

    Rotation closes a log file at a set time or size and opens a new one. Retention keeps logs as routine for a period fixed by policy. Preservation keeps particular logs beyond that period for an incident, investigation or legal case. A clipping level is a threshold below which events are treated as normal and not reported.

    Read this part again

Sources