Defensive Security

Logging: What to Collect, What to Keep, and What It Will Cost You

Log strategy usually swings between two failures. Collect everything, and the storage bill arrives in month four and gets cut indiscriminately. Collect reluctantly, and the first serious investigation stalls because the relevant data expired a fortnight before anyone noticed the intrusion.

Logging: What to Collect, What to Keep, and What It Will Cost You

Start from the questions, not the sources

Write down the questions you will need to answer during an incident. They are consistent across organisations:

  • Who logged into this system, when, and from where?
  • What ran on this machine, and what started it?
  • What did this host connect to externally?
  • What changed — accounts, group memberships, permissions, configuration?
  • What did this user access, and was that normal for them?
  • What left the network, and how much of it?

Every log source is then judged by whether it helps answer one of these. Sources that answer none are being collected out of habit.

The order that gives most value per rupee

First, identity. Authentication logs from your directory and cloud identity provider. Nearly every intrusion touches identity somewhere, and these logs are small relative to their value. Sign-ins, failures, MFA events, privilege changes, consent grants.

Second, endpoints. Process creation with command lines, and network connections per process. This is where an investigation actually gets answered. Volume is significant, so this is where tiering matters.

Third, the perimeter and DNS. Firewall denies and allows at the egress, proxy logs, and resolver query logs with the source host. DNS in particular is cheap and disproportionately useful.

Fourth, cloud control plane. API activity in your cloud accounts. Small volume, and the only record of an attacker changing infrastructure.

Fifth, applications. Authentication events, authorisation failures, administrative actions and data exports from your own systems. Usually the weakest area, because it requires development work rather than a configuration change.

Retention: hot, warm, cold

Most budget pain comes from keeping everything in the expensive tier. Three tiers solve it.

Hot — searchable in seconds, used for detection and live investigation. Thirty to ninety days. This is where cost concentrates, so it holds the highest-value sources only.

Warm — searchable in minutes. Six to twelve months. This is what you reach for when an intrusion turns out to have started earlier than you thought, which it usually has.

Cold — cheap object storage, retrievable in hours. One to several years, driven by regulation and by the realistic worst case.

The common mistake is a flat thirty days for everything. Attackers routinely remain undetected for far longer, so a thirty-day window frequently means the beginning of the intrusion is simply gone, and you can never answer how they got in.

Reduce volume before it reaches storage

Most log volume is noise that no detection uses.

  • Filter high-volume, low-value events at the collector — routine network logon events, successful health checks, chatty application debug output.
  • Sample where full fidelity is not needed.
  • Drop duplicate fields and verbose structures.
  • Send only firewall denies at full fidelity if allows are overwhelming, while keeping aggregate allow data.

Review this periodically, because volume creeps and the biggest contributor is rarely the one anyone expected.

Make the logs trustworthy

Logs that exist only on the compromised host are logs the attacker can edit. Forward centrally, promptly, and restrict who can delete from the central store. An attacker with domain administrator rights who can also clear your central logs has removed the investigation.

Synchronise time everywhere. Correlating three sources with clocks that disagree by minutes turns a timeline into guesswork, and this is discovered during the incident rather than before it.

Verify coverage rather than assuming it

The most common gap is not a source you decided against — it is a source that silently stopped reporting. An agent that failed in March on forty hosts, a firewall that stopped forwarding after a firmware update.

Alert on absence. If a source that normally sends events every minute sends nothing for an hour, somebody should know. Checking coverage during an incident is how organisations discover they have been blind for months.

Frequently asked questions

Which log source should we collect first?
Identity and authentication logs. Almost every intrusion touches identity, the volume is modest, and they answer the first questions any investigation asks.
How long should logs be retained?
Thirty to ninety days searchable, six to twelve months in cheaper storage, and longer in archive where regulation requires it. Attackers often go undetected for longer than thirty days, so a flat short window frequently loses the start of the intrusion.
How do we control logging costs?
Filter high-volume low-value events at the collector, tier storage by how quickly you need to search it, and review the top contributors to volume periodically.

Related reading

0 comments

Leave a comment

Comments are moderated before appearing.