Logging Concepts: Configuration, Time Sync, Ingestion, Integrity and Retention
27 Nov 2026
Logs are the security team’s memory. When something goes wrong, they are often the only witness that saw it happen: who logged in, which process started, which IP talked to which server, and when. But a log is only useful if four things are true. It was collected, it contains the right detail, nobody tampered with it, and it is still there when you need it.
Five concepts make those things true. This article walks through each of them, in the order a log lives through them, from the moment an event is written to the day it is deleted:
- Configuration: deciding what to log and in how much detail
- Time synchronization: making every clock agree before anything is written
- Ingestion: getting logs from everywhere into one place
- Integrity and security: proving logs are complete and unaltered
- Retention: keeping logs long enough, and not forever
The settings on each system that decide which events get written to a log and in how much detail. If something is not configured to be logged, no later step can recover it.
- endpoints
- servers
- network
- cloud
Everything that produces logs: laptops and servers, firewalls and routers, cloud accounts (AWS, Azure) and applications. Each one records what happens on it.
- agents
- syslog
- WEF
- cloud APIs
Collecting those logs and moving them to one central place, using small programs on each machine (agents), the standard syslog protocol, Windows Event Forwarding (WEF, built into Windows) or cloud APIs.
- parse
- map fields
- enrich
Every product writes logs differently. Normalizing turns each one into the same named fields (time, user, IP, action) so they can be searched together, and adds context such as the IP address's country.
- SIEM search
- correlate
- alert
A SIEM (Security Information and Event Management) system searches all logs at once, links related events from different systems and raises an alert when something looks like an attack.
- hot
- warm
- cold
- archive
- delete
Keeping logs for a set time: recent ones on fast storage, older ones on cheaper and slower storage, then deleting them securely when the retention policy says so.
All devices take their time from the same source using NTP (Network Time Protocol) and record it in UTC, one worldwide time zone, so events from different systems line up in the right order.
Logs are encrypted in transit with TLS, only a few people can access them, hashes act as fingerprints that reveal any change, and storage is set so entries cannot be edited or deleted.
Keep this picture in mind. Every section below zooms into one part of it.
1. Configuration: deciding what to log
What it means
Logging configuration is how you decide what gets recorded, how much detail each record has, and where it goes. The most expensive SIEM (the central system that collects and analyzes logs, covered in section 3) is useless if the server never wrote the event in the first place. Many breach investigations end with the sentence “logging was not enabled”.
A useful mindset: log for the questions you will need to answer. During an incident you will ask who did it, what did they do, when, from where, to what, and did it succeed? Every important log record should answer those six questions.
Logging levels (severity)
Most systems let you choose a logging level. Syslog defines eight severities, from 0 (most severe) to 7 (least):
- 0 Emergency system is unusable
- 1 Alert act immediately (e.g. database corrupted)
- 2 Critical hardware or component failure
- 3 Error operation failed (service crashed)
- 4 Warning might become a problem (disk 90% full)
- 5 Notice normal but significant (config change)
- 6 Informational routine events (user logged in)
- 7 Debug developer detail for troubleshooting
Setting a device to a level means log this level and everything more severe. A firewall set to level 4 (Warning) records levels 0 through 4, and ignores Notice, Informational and Debug.
A handy mnemonic for the order 0 to 7: Every Awesome Cisco Engineer Will Need Ice cream Daily (Emergency, Alert, Critical, Error, Warning, Notice, Informational, Debug).
The trade-off is signal vs noise:
- Too little logging: you miss the evidence. Many security-relevant events (successful logons, config changes) are Informational or Notice, so a level that is too strict hides them.
- Too much logging: storage costs explode, the SIEM slows down, and real alerts drown in noise. Debug is meant for short-term troubleshooting and can also leak sensitive data such as session tokens, so turn it off afterwards.
Applications usually use a simpler scale: FATAL, ERROR, WARN, INFO, DEBUG, TRACE. The same rules apply.
What to turn on, by platform
Windows. Configure the Advanced Audit Policy through Group Policy, so every machine gets the same settings. Events every analyst should know:
| Event ID | Meaning | Why it matters |
|---|---|---|
| 4624 / 4625 | successful / failed logon | brute force, password spraying, lateral movement (watch the logon type) |
| 4688 | new process created | what ran; enable “include command line” to see the full command |
| 4720 | user account created | attackers create backdoor accounts |
| 4728 / 4732 | member added to a security group | privilege escalation (for example into Domain Admins) |
| 4719 | system audit policy changed | someone may be turning logging off |
| 1102 | Security log cleared | a classic sign of an attacker covering tracks |
Many SOCs also deploy Sysmon, a free Microsoft tool that adds detailed events such as process creation with hashes (Event 1) and network connections (Event 3).
Linux. rsyslog or syslog-ng handle classic logs, journald collects systemd logs, and auditd records security events such as file access and command execution. Authentication logs live in /var/log/auth.log (Debian/Ubuntu) or /var/log/secure (RHEL family).
Network devices. Log denied and important allowed traffic, admin logins and configuration changes. Send them to your collector, not just to a local buffer that overwrites itself.
Cloud. Make sure management-plane logging (CloudTrail, Azure Activity Log, Entra ID sign-in logs) is enabled in every account and region, and that it is sent somewhere the account’s own admins cannot easily delete.
Configuration best practices
- Use a standard baseline: define once what each system type must log, then apply it centrally (Group Policy, configuration management tools like Ansible, or cloud policies).
- Watch for configuration drift: settings change over time. Periodically verify that systems still log what the baseline says.
- Include the right fields: timestamp with time zone, hostname, user, source and destination IP, action and outcome.
- Do not log secrets: passwords, full card numbers and session tokens should never end up in log files.
- Test it: trigger a failed logon on purpose and confirm it appears in the SIEM, correctly parsed, within minutes.
Key takeaway
If an investigation cannot find evidence because “the events were never recorded”, the fix is audit policy / logging configuration, not a bigger SIEM. If the SIEM is overwhelmed with low-value events, the fix is tuning the logging level or filtering.
2. Time synchronization: making every clock agree
What it means
Time synchronization means every device that produces logs agrees on what time it is, usually to within milliseconds, by getting its time from a common, trusted source using NTP (Network Time Protocol).
This sounds boring until you try to investigate an incident without it. Every computer has its own internal clock, and those clocks drift, gaining or losing seconds a day. After weeks or months without correction, two servers can disagree by minutes. Virtual machines restored from snapshots can be off by days.
Why it is critical for security
- Correlation: SIEM rules like “failed logons followed by a success within 2 minutes” only work if both events have comparable timestamps.
- Building a timeline: incident response is about putting events in the right order. Wrong clocks create a wrong story.
- Evidence: inaccurate timestamps can make log evidence easy to challenge.
- Authentication: Kerberos (used by Active Directory) rejects authentication if the clocks of client and server differ by more than 5 minutes by default. Certificates and MFA codes also depend on correct time.
- FW01, WEB01, DC01
- Three example machines: a firewall, a web server and a domain controller (the Windows server that handles logins for the whole network).
- Clock drift
- Every computer clock gains or loses a little time. Without correction, machines can end up minutes apart, as WEB01 (+4 min) and DC01 (−3 min) do here.
- Why it matters
- Investigators sort events by time. With wrong clocks, step 3 (the logon) looks like it happened before the attack started, which leads to the wrong conclusions.
- NTP
- Network Time Protocol keeps every machine within milliseconds of a trusted time source, so the sorted order matches what really happened.
How NTP works
NTP organizes time sources in layers called strata. A stratum number is the distance from a reference clock:
- Stratum
- A level in the time hierarchy, counted as distance from a perfect clock. Lower numbers are closer to the reference; 16 means "not synchronized".
- Stratum 0
- The reference clocks themselves: GPS receivers and atomic clocks. They are hardware, not network servers.
- Stratum 1-2
- Public time servers wired to those clocks, and below them your own internal NTP servers, often a domain controller (the PDC emulator role in Active Directory).
- Stratum 3
- Everything else in your network takes time from your internal servers, so all devices agree with each other.
- Kerberos
- The login system used by Windows networks. It rejects logins when two clocks differ by more than 5 minutes, so bad time can lock people out.
- NTS
- Network Time Security (RFC 8915) adds encryption and authentication to NTP, so an attacker cannot feed your devices a fake time.
- Stratum 0: the reference clocks themselves (GPS receivers, atomic clocks). They do not sit on the network directly.
- Stratum 1: servers directly connected to a stratum 0 device.
- Stratum 2, 3, …: servers that sync from the level above. The maximum usable stratum is 15; 16 means “unsynchronized”.
NTP uses UDP port 123. In an Active Directory domain, members sync from domain controllers, and the domain controller holding the PDC emulator role should sync from a reliable external source.
Best practices
- Use internal NTP servers. Point all devices at two or more internal time servers, and point those at several trusted upstream sources. Fewer devices talk to the internet, and everyone gets the same time.
- Store timestamps in UTC. Time zones and daylight-saving changes make local times ambiguous (01:30 can happen twice in one night). Store and correlate in UTC, and convert to local time only for display. Use an unambiguous format such as ISO 8601:
2026-11-27T09:14:03.512Z(theZmeans UTC). - Prefer log formats that carry full timestamps. Classic syslog (RFC 3164) has no year and no time zone. RFC 5424 syslog and JSON logs can include both.
- Secure NTP. A rogue or spoofed time source can shift clocks, breaking authentication and corrupting evidence. Use NTS (Network Time Security, RFC 8915) or authenticated NTP where supported, and restrict who may serve time on your network.
- Monitor drift. Alert when a host’s offset exceeds a threshold. Useful commands:
# Windows
w32tm /query /status # current source, stratum and last sync
w32tm /resync # force a resync
# Linux
timedatectl # is NTP enabled and synchronized?
chronyc tracking # offset from the time source (chrony)
chronyc sources -v # which servers are being used
Key takeaway
When events appear out of order, cannot be correlated across systems, or Kerberos authentication suddenly fails, check NTP / time synchronization first. When logs from different regions are confusing, normalize timestamps to UTC.
3. Ingestion: getting logs into one place
What it means
Log ingestion is the process of collecting log data from many different sources and bringing it into a central system, usually a SIEM (Security Information and Event Management) platform, where it can be searched, correlated and turned into alerts.
Think of a SIEM as a newsroom. Reporters (your servers, firewalls and cloud accounts) are all over the city. Ingestion is the phone lines, couriers and translators that get every report to the editor’s desk, in a language the editor understands, without losing any on the way.
Why centralize at all? Because attacks cross systems. A single intrusion might touch a firewall, a web server, a domain controller and a cloud account. Each one only sees its own piece. Only when the pieces sit side by side can you see the whole attack.
Where logs come from
| Source | Typical logs | Examples |
|---|---|---|
| Endpoints and servers | OS security events, process starts, logons | Windows Security log, Sysmon, Linux auth.log / secure, auditd |
| Network devices | allowed/denied traffic, VPN logons, config changes | firewalls, routers, switches, IDS/IPS, proxies |
| Identity | sign-ins, MFA results, privilege changes | Active Directory, Entra ID (Azure AD), Okta |
| Cloud platforms | API calls and admin activity | AWS CloudTrail, Azure Activity Log, Google Cloud Audit Logs |
| Applications | logins, errors, transactions | web servers, databases, custom apps |
| Security tools | detections and blocks | EDR, antivirus, email gateways, DLP |
How logs travel: push vs pull, agent vs agentless
There are two big questions in ingestion: who starts the conversation, and is there software installed on the source.
- Push: the source sends events as they happen. Syslog and Windows Event Forwarding work this way. This is near real time.
- Pull: the SIEM or collector asks the source for new events on a schedule, usually through an API. Most cloud logs (for example CloudTrail or Microsoft 365 audit logs) are pulled.
| Agent-based | Agentless | |
|---|---|---|
| How | a small program on the host reads logs and ships them | the host sends natively (syslog, WEF) or the SIEM pulls (API, WMI) |
| Pros | rich data, can filter and buffer locally, encrypts, survives network blips | nothing to install, works on appliances you cannot modify |
| Cons | must be deployed, patched and monitored on every host | less control, often less detail, more network dependency |
| Examples | Splunk Universal Forwarder, Elastic Agent, Wazuh agent, NXLog | syslog from a firewall, Windows Event Forwarding, cloud API pulls |
The common transport protocols are worth memorizing:
- Syslog: the universal language of network devices and Linux. Traditionally UDP 514 (fast, but no delivery guarantee and no encryption), commonly TCP 514 (reliable), and TCP 6514 for syslog over TLS (reliable and encrypted, RFC 5425).
- Windows Event Forwarding (WEF): built into Windows. Sources forward selected events to a Windows Event Collector (WEC) over WinRM (HTTP 5985 / HTTPS 5986).
- HTTPS APIs: cloud services and modern apps, usually JSON.
- Agent
- A small program installed on a server that reads its logs and sends them on. It can filter, buffer and encrypt before sending.
- WEF / WinRM
- Windows Event Forwarding is built into Windows: servers forward chosen events to a central Windows Event Collector, using the WinRM remote-management protocol (ports 5985/5986).
- Syslog (514 / 6514)
- The standard log protocol for Linux and network devices. Port 514 is plain text; port 6514 wraps it in TLS encryption so nobody can read or alter it on the way.
- API pull
- Cloud services keep their own logs. The collector or SIEM asks their API (for example AWS CloudTrail or Microsoft Entra ID) for new events every few minutes.
- Collector
- A middle server that receives logs from everything, decrypts them, holds them in a queue if the SIEM is busy or down, drops obvious noise and forwards the rest securely.
- SIEM
- Security Information and Event Management: the central system that stores, searches and correlates all logs, adds context (enrichment) and alerts analysts.
- Push vs pull
- Push: the source sends each event as it happens (near real time). Pull: the SIEM asks the source for new events on a schedule.
Parsing, normalization and enrichment
Raw logs arrive in many formats: classic syslog lines, Windows XML events, JSON, vendor formats like CEF (Common Event Format) and LEEF (Log Event Extended Format). To search across all of them, the SIEM must:
- Parse: break the raw text into named fields (time, host, user, IP, action).
- Normalize: map those fields into one common schema, so a “failed logon” from Windows and a “Failed password” from Linux both become
event.action = logon-failure. - Enrich: add context the original log did not have: the country for an IP (GeoIP), the owner and criticality of the asset, the user’s department, or whether the IP appears in threat intelligence feeds.
EventID=4625 TimeCreated=2026-11-27T09:14:03.512Z TargetUserName=jsmith IpAddress=203.0.113.7 Computer=DC01 LogonType=3 Nov 27 09:14:05 web01 sshd[2211]: Failed password for root from 203.0.113.7 port 52113 ssh2 | Field | From A | From B |
|---|---|---|
| @timestamp | 2026-11-27T09:14:03.512Z | 2026-11-27T09:14:05Z * |
| event.action | logon-failure | logon-failure |
| user.name | jsmith | root |
| source.ip | 203.0.113.7 | 203.0.113.7 |
| host.name | DC01 | web01 |
| event.provider | Windows Security (4625) | sshd |
* Classic syslog (RFC 3164) has no year and no time zone. The SIEM has to assume them, which is one more reason to send RFC 5424 / ISO 8601 timestamps in UTC.
Without normalization, an analyst would need a different search for every product. With it, one query (“show all failed logons from this IP”) covers everything.
Aggregation and correlation
Once data is normalized, the SIEM can aggregate (combine repeated events, like 500 identical firewall denies, into one record with a count) and correlate (connect related events from different sources). A correlation rule might say: five or more failed logons from one IP across any hosts within two minutes, followed by a success, raise a “possible password spraying” alert.
Ingestion problems you should recognize
- Volume and cost: SIEMs are often licensed by EPS (events per second) or GB per day. Sending everything can be very expensive.
- Dropped events: UDP syslog can silently lose packets under load. Collectors with buffers or queues prevent loss when the SIEM is slow or offline.
- Silent sources: if a server stops sending logs, nothing alerts you by default. Good SOCs alert on missing data (“no events from DC01 in 15 minutes”).
- Parsing failures: a vendor update changes the log format, the parser breaks, and fields come in empty. Monitor parsing error rates.
- Filtering at the source: dropping noisy, low-value events before ingestion saves money, but be careful not to throw away evidence you will need later.
Key takeaway
When logs from many devices “cannot be correlated” or “use different formats”, the answer is normalization in a SIEM. When syslog messages get lost or travel unencrypted, move from UDP 514 to TCP or TLS syslog (6514).
4. Integrity and security: protecting the evidence
What it means
Log integrity means you can prove the logs are complete and unaltered since they were written. Log security means protecting them from being read, changed or deleted by the wrong people.
Why does this matter so much? Because attackers know logs can expose them. Clearing or disabling logs is a well-known attacker technique (MITRE ATT&CK T1070 Indicator Removal, including T1070.001 Clear Windows Event Logs, and T1562.002 Disable Windows Event Logging). If an attacker with admin rights can edit the only copy of the logs, those logs prove nothing.
Logs may also end up as evidence in disciplinary cases or court. Then you must show they are trustworthy, which is where chain of custody comes in.
The CIA triad, applied to logs
- Confidentiality: logs contain usernames, IP addresses, internal hostnames and sometimes personal data. Not everyone should read them.
- Integrity: nobody can change or delete a log entry without it being detected.
- Availability: logs are there when needed, even if the original server is wiped or encrypted by ransomware.
How to protect logs
1. Get them off the box, fast. The single most important control. Forward logs to a central collector in (near) real time. If an attacker clears the local Security log, the copies already in the SIEM survive, and the clearing itself (Event 1102) becomes an alert.
2. Encrypt in transit. Use TLS syslog (TCP 6514), HTTPS-based agents or WEF over HTTPS, so logs cannot be read or modified on the network.
3. Control access (least privilege and separation of duties). System administrators should not be able to delete the SIEM’s copy of the logs about their own actions. Give analysts read access, restrict delete rights to very few people, and log access to the logs themselves.
4. Make storage immutable. Use WORM (write once, read many) storage, for example object storage with retention locks such as AWS S3 Object Lock, or append-only log stores. Data can be added, but not changed or deleted until the retention period ends.
5. Use hashing to detect changes. A cryptographic hash (for example SHA-256) is a fingerprint of the data. Hash log files when they are closed and store the hashes separately. Stronger still, chain the hashes, so each entry’s hash covers the previous one:
- Entry
- One log record, for example "09:14:05 FAIL root" means a failed login for the root account at 09:14:05.
- Hash
- A short fingerprint calculated from the data (for example with SHA-256). Change even one character and the fingerprint changes completely.
- Prev
- Each entry also stores the hash of the entry before it. That links the entries into a chain, so editing an old entry breaks every link after it.
- Tampering
- In the animation, an attacker changes entry 3 from "jsmith" to "admin". Its new hash no longer matches what entry 4 stored, so the change is detected.
Cloud services use the same idea. AWS CloudTrail’s log file integrity validation, for example, creates signed digest files containing hashes of every log file, so you can prove whether a file was modified or deleted.
6. Digitally sign. Signing hashes with a private key proves who produced them and that they have not changed since.
7. Monitor the logging pipeline itself. Alert on: logs cleared (1102, 104), audit policy changed (4719), logging service stopped, agents that stop sending heartbeats, and sudden drops in volume from a source.
8. Document chain of custody. When logs are collected as evidence, record who collected them, when, how, the hash values, and every hand-off, so their integrity can be demonstrated later.
Key takeaway
To prove logs were not altered, use hashing and digital signatures. To survive an attacker clearing local logs, forward them to a SIEM in real time. To keep logs unchangeable for years, use WORM / immutable storage.
5. Retention: how long to keep logs
What it means
Log retention is the policy that defines how long each type of log is kept, where and in what form it is kept during that time, and how it is destroyed at the end.
There are two opposite risks:
- Keeping too little: attackers often stay hidden for weeks or months before anyone notices. If you only keep 14 days of logs, you may discover a breach and find that the evidence of how it started is already gone.
- Keeping too much: storage costs grow forever, searches slow down, and old logs full of personal data become a privacy and legal liability. Under the GDPR storage limitation principle, for example, personal data (and log files often contain it) should not be kept longer than necessary.
What drives the retention period
- Laws and regulations: these set minimums for some industries and data types. Examples often cited:
- PCI DSS (card payments): keep audit log history for at least 12 months, with at least the most recent 3 months immediately available for analysis (requirement 10.5.1 in v4.0).
- HIPAA (US healthcare): required security documentation must be kept for 6 years, and many organizations apply that period to related audit logs.
- SOX (US public companies): financial audit records are commonly retained for 7 years.
- Contracts and cyber-insurance requirements.
- Internal policy and investigation needs: how far back do your incident responders realistically need to look?
- Legal holds: when litigation or an investigation is expected, the relevant logs must be preserved regardless of the normal schedule until the hold is released.
Always check the current text of the regulations that apply to you. Numbers change between versions, and lawyers and compliance teams should set the final policy.
Storage tiers: not all old logs need to be fast
Recent logs are searched constantly, and old logs rarely. So most organizations store logs in tiers:
- Hot
- The newest logs on fast, expensive storage, fully indexed. Analysts search these all day and get answers in seconds.
- Warm
- Older logs on cheaper disks. Still searchable, just slower.
- Cold
- Compressed to save space. Searches are slow and used mainly for investigations.
- Archive
- Long-term storage such as cloud object storage, often WORM (write once, read many: nobody can edit or delete it). Logs must be restored before searching.
- Dispose
- When the retention period ends, logs are deleted in a documented, secure way. Keeping them longer adds cost and privacy risk.
- Legal hold
- If there is a lawsuit or investigation, the affected logs must be kept regardless of the normal schedule until the hold is lifted.
- Hot: the last days or weeks, on fast storage and fully indexed. Live investigations and alerting happen here.
- Warm: older, on cheaper storage, still searchable but slower.
- Cold: compressed, cheap, slow to search.
- Archive: object storage or tape, often WORM-protected, must be restored before searching. Cheapest per GB.
At the end of the retention period, logs should be securely disposed of, deleted in a way that is documented and verifiable. Keeping data “just in case” past the policy is a risk, not a safety net.
Estimating storage
Capacity planning starts with a simple formula:
events per second × average event size × 86,400 seconds = bytes per day
For example, 2,000 EPS × 500 bytes × 86,400 ≈ 86.4 GB of raw logs per day, or more than 31 TB per year before compression. Try your own numbers:
Key takeaway
Compliance needs are met with a retention policy plus an archive tier. If investigators cannot find logs from before a breach was detected, retention was too short. Logs needed for a lawsuit go under legal hold, which overrides normal deletion.
Putting it all together
| Concept | The question it answers | Key controls |
|---|---|---|
| Configuration | Are we recording the right events, at the right detail? | audit policy baselines, logging levels, Sysmon/auditd, no secrets in logs, drift checks |
| Time synchronization | Can we trust the order of events? | internal NTP hierarchy, UDP 123, UTC + ISO 8601, NTS, drift monitoring |
| Ingestion | Do all the logs reach one place, in one language? | agents, syslog (TLS 6514), WEF, APIs, collectors with buffers, parsing, normalization, enrichment, missing-source alerts |
| Integrity and security | Can we prove nobody altered or deleted them? | real-time forwarding, TLS, least privilege, WORM, hashing, signatures, alerts on log clearing, chain of custody |
| Retention | Will the logs still be there, and are we keeping them too long? | policy driven by regulation and investigations, hot/warm/cold/archive tiers, legal hold, secure disposal |
The five concepts depend on each other. Perfect retention is useless if ingestion dropped the events. Perfect ingestion is useless if the configuration never recorded them, or if the clocks disagreed when it did. And none of it holds up as evidence without integrity and accurate time.
Quick self-check:
- Which port does syslog over TLS use? (TCP 6514)
- Which Windows event shows the Security log was cleared? (1102)
- What is the default Kerberos clock-skew tolerance? (5 minutes)
- What does NTP stratum 16 mean? (unsynchronized)
- What does a legal hold do to the retention schedule? (pauses deletion for the affected data)
Good logging is not glamorous, but it is the difference between “we think the attacker got in somehow” and “the attacker logged in from 203.0.113.7 at 09:14:09 UTC using jsmith’s account, and here is the proof”.