Logging: what to collect for an incident

Most incident investigations fail because the decisive log is missing or has already been overwritten. What to collect from each source, and how long to keep it.

Topic
IT security
Author
ARLITECH expert team
Published
Updated

The sentence you hear most often on day three of an investigation: "that log is only kept for 7 days." The attacker, meanwhile, typically got in weeks earlier.

The principle

Collecting everything is pointless. Licensing is typically priced by data volume, so unnecessary logs cost money and bury what matters.

After an incident you need to be able to answer four questions:

  1. How did they get in? The initial entry point, with a timestamp.
  2. How far did they get? Which systems they touched.
  3. What did they take? Whether data was exfiltrated, and how much.
  4. When did it start? Because this decides how far back you have to look.

Every logging decision can be traced back to these four questions.

By source: what to collect

Identity (the most important source)

If you can pick only one source, pick this one. The vast majority of attacks start with credentials.

  • Successful and failed sign-ins, with source IP and device
  • Permission changes, especially membership of privileged groups
  • Password resets and account creation
  • MFA challenge outcomes, including denied requests
  • Kerberos ticket requests (TGT and TGS), especially unusual volumes

Endpoint

  • Process creation, with the parent-child relationship. This is the most valuable data: it shows, for example, when an office application has launched a command interpreter.
  • Command-line arguments. Without them, half of the process log is useless.
  • Service and scheduled task creation
  • Outbound network connections tied to a process

Network

  • Firewall allows and denies, with source and destination pairs
  • VPN connects and disconnects
  • DNS queries. An underrated source: command-and-control traffic often shows up here first.
  • Proxy logs, with outbound data volumes

Applications and cloud

  • Email: mailbox rule creation (a classic sign that the account has been taken over), bulk downloads, delegation
  • File shares: large volumes read in a short time
  • Administrative actions in cloud services
Command-line argument logging is the best value-for-money setting you can turn on. It is off by default, even though it takes a single Group Policy setting. Without it, an investigation can see that a script interpreter started, but not what it ran.

Retention

You need to set two separate values: how long logs stay immediately searchable, and how long you keep them in the archive.

Data Immediately searchable Archived
Identity 90 days 12-24 months
Endpoint 30-90 days 6-12 months
Firewall, proxy 30 days 6-12 months
DNS 30 days 6 months
Email, cloud 90 days 12 months

The reason for 90 days is average attacker dwell time, which has been measured in weeks for years. On top of that, detection often starts from an external notification, which means it comes late. With 30-day retention, it often never becomes clear how they got in.

The archive tier can sit on cheaper, slower storage. It does not have to be searchable right away; it just has to exist.

What almost everyone leaves out

Time synchronization. If device clocks drift apart, correlation is useless. Use NTP everywhere, with a single time zone, ideally logging in UTC. It sounds trivial, yet it is the most common problem at the start of an investigation.

Alerting on log deletion. The first thing an attacker does is cover their tracks. Clearing a log or turning off logging should trigger an alert on its own, because nobody does that in normal operation.

Copying logs off the host. A log that stays on the machine is in the attacker's hands; one copied to the SIEM or to separate storage is not. In an investigation, this decides whether there will be anything to analyze.

Network devices. Many organizations log their servers but not their switches, routers, and edge devices. Yet the edge is exactly where attackers come in.

Logs from your own security tools. The EDR, the WAF, and the mail filter all keep logs. These are the densest signal sources, because the data is already filtered.

How much data are we talking about

As a rough order of magnitude, per user per day:

  • Identity: 5-15 MB
  • Endpoint (with process logging): 20-60 MB
  • Network: 10-40 MB, depending on traffic
  • Email and cloud: 5-20 MB

For a 200-person organization, that comes to roughly 10-25 GB a day if you collect everything. This is why prioritization matters: identity and endpoint data deliver most of the value, while storing raw network traffic rarely pays off.

Checklist questions

You need the answers to these now, before an incident:

  1. If it turned out today that an attacker had been inside for two months, could you tell how they got in?
  2. Is there a log that an attacker with domain admin rights cannot delete?
  3. Do the clocks match on your key systems?
  4. Who gets the alert at 3 a.m. on a Sunday, and what do they do with it?
  5. Have you turned on command-line argument logging?

If the answer to any of them is no, that is where to start. We have written separate articles on SIEM deployment and the first 24 hours of an incident, and designing your logging architecture is part of our IT security services.

Contact

Ready to secure your critical systems?

Our experts will assess where your security stands and build a roadmap that fits your organization.

ARLITECH's office in Gödöllő

Visit us

You are welcome to visit our Gödöllő office in person.

Address
Centrum Office Building, 2100 Gödöllő, Dózsa György út 13, 3rd floor, office 309
Office hours
Mon–Fri, 9 a.m. to 5 p.m.
Get directions (opens in a new tab)