Skip to content
Visual explainer 2h 30m to learn 4 steps

Log sources & what to collect

Choose the endpoint, network, identity and cloud logs that matter most.

By Invicly Tech, , in Cyber Security Fundamentals. About 10 minutes to read.

Topic 33 of 49

In short

Detection is only as good as the logs collected. High-value sources include endpoint (process and Sysmon), network, identity and cloud logs. Logs must be forwarded reliably, timestamped consistently, and retained long enough to investigate.

Explained simply

A log is a line of text that a system writes when something happens: a user logs in, a program starts, a file is downloaded. Defenders read logs the way detectives read witness statements. If nothing was written down, there is nothing to investigate.

You cannot collect everything. It costs money and buries the useful lines. So you pick the sources that show attacker behaviour: endpoints (laptops and servers), identity (logins and account changes), network (firewall, DNS and web proxy) and cloud (API activity in AWS, Azure or Google Cloud).

Logs are not safe on the machine that wrote them. An attacker who becomes admin can delete them. So a small program called an agent or forwarder copies them to a central place, usually a SIEM, within seconds of being written.

Two more decisions matter. Time: every system must agree on the clock, and you store times in UTC so events from different machines line up. Retention: you keep logs long enough to look back, because attackers often stay hidden for weeks before anyone notices.

Press Play on a diagram to walk through it one step at a time.

FlowLog pipeline
  1. Step 1
    Source

    Endpoint, network, identity, cloud.

  2. Step 2
    Agent

    Collects and forwards.

  3. Step 3
    SIEM

    Parses and indexes.

  4. Step 4
    Analyst

    Searches and alerts.

MapWhat to collect first
High-value log sources
  • Endpoint
    • Sysmon process and network events
    • Windows Security log
    • Linux auth log and auditd
    • EDR telemetry
  • Identity
    • Domain controller logons
    • Entra ID or Okta sign-ins
    • MFA and password resets
  • Network
    • Firewall allow and deny
    • DNS queries
    • Web proxy
    • VPN logins
  • Cloud
    • CloudTrail or Azure Activity Log
    • Storage access logs
    • Kubernetes audit log
  • Email and SaaS
    • Mail gateway verdicts
    • Mailbox rule changes
    • File sharing events

In depth

The high-value sources, with real event IDs

Start with sources that see the most attacker steps for the least volume. On Windows, the Security log records logons (4624 success, 4625 failure), new accounts (4720), changes to security groups (4728, 4732) and the log itself being cleared (1102). Process creation (4688) is very useful, but only if you turn on the policy that adds the full command line. Sysmon, a free Microsoft tool, adds richer events: process creation with hashes and the parent process (ID 1), network connections (ID 3), file creation (ID 11) and DNS queries (ID 22).

On Linux, collect authentication logs (/var/log/auth.log on Debian and Ubuntu, /var/log/secure on RHEL) and auditd. Domain controller and Entra ID sign-in logs show who logged in from where. Cloud audit logs such as AWS CloudTrail record every API call. DNS and proxy logs show where machines are talking to.

  • A burst of 4625 then a 4624 for the same account: possible password guessing that worked
  • 7045 in the System log: a new service was installed
  • Sysmon needs a config file; community configs are a good start
  • DNS logs catch malware calling home even when its traffic is encrypted

Agents, forwarders and syslog

There are two ways to move logs. With an agent, a small program on each host reads local logs and ships them: Elastic Agent, the Splunk Universal Forwarder, the Wazuh agent or Fluent Bit. Good agents buffer to disk when the network is down, compress and encrypt data with TLS, and resend anything the server did not acknowledge. Agentless options include Windows Event Forwarding, which is built into Windows and moves events over WinRM, and syslog, the classic Unix protocol.

Syslog over UDP port 514 is simple but can drop messages silently and sends them in clear text. Prefer TCP, or syslog over TLS on port 6514. Firewalls and switches often speak only syslog, so many teams run a central collector that receives syslog and forwards it to the SIEM.

SequenceHow a good agent avoids losing logs
Log file
Agent
SIEM
  1. 1Agent reads new lines
    Log file to Agent: Agent reads new lines
  2. 2Batch sent over TLS
    Agent to SIEM: Batch sent over TLS
  3. 3Acknowledged, agent moves on
    SIEM to Agent: Acknowledged, agent moves on
  4. 4Next batch: no reply, network down
    Agent to SIEM: Next batch: no reply, network down
  5. 5Retry later from disk buffer
    Agent to SIEM: Retry later from disk buffer
  6. 6Acknowledged, nothing lost
    SIEM to Agent: Acknowledged, nothing lost

Time: UTC, NTP and timestamp formats

Correlation means putting events from different machines on one timeline. That breaks if clocks disagree. A firewall five minutes fast makes a connection look like it happened before the phishing click that caused it. Keep every system in sync with NTP (chrony or systemd-timesyncd on Linux, the Windows Time service on Windows). Kerberos logons even fail by default when a clock is more than 5 minutes off.

Format is the second problem. Old-style syslog (RFC 3164) timestamps look like Oct 11 22:14:15, with no year and no time zone, so the SIEM must guess. Prefer ISO 8601 with an offset, such as 2026-03-08T14:05:09Z, and store everything in UTC. Analysts can still view local time on screen. Keep both the event time and the time the SIEM received it: a big gap points to a delayed or broken forwarder.

  • timedatectl shows whether a Linux clock is synchronised
  • chronyc tracking shows the current offset
  • w32tm /query /status shows the Windows time source

Retention and storage sizing

Retention is how long you keep logs. It must be longer than the time it takes to notice an attack, and some intrusions are found months after they start. Rules can set minimums too: PCI DSS, the card payment standard, asks for 12 months of audit logs, with the latest 3 months ready to search right away.

Keeping everything on fast disks is expensive, so most SIEMs use tiers. Hot storage holds recent days for instant searches. Warm and cold tiers hold older data more cheaply but search more slowly. Archive storage, often object storage like S3, keeps the long tail.

Size it with simple maths: events per second times average event size times 86,400 seconds. 2,000 events per second at 500 bytes is about 86 GB a day before compression. Note that AWS CloudTrail event history only covers 90 days unless you create a trail that saves logs to S3.

LayersStorage tiers, fastest at the top
  1. 1
    Hot

    Last days, fast disks, instant search

  2. 2
    Warm

    Weeks, cheaper disks, still searchable

  3. 3
    Cold

    Months, slow but available

  4. 4
    Archive

    Object storage, restore before searching

Learn it in 4 short steps

About 40m each. Track them with a timer in your plan.

  1. 1
    List high-value log sources~40m
  2. 2
    Explain log forwarding and agents~40m
  3. 3
    Normalise timestamps to UTC~40m
  4. 4
    Plan retention and storage~40m

Key points

  • Endpoint, network, identity and cloud logs cover most attacks.
  • Agents forward logs reliably to the SIEM.
  • Normalise timestamps to UTC to correlate events.
  • Retention must outlast the time to detect an incident.

Key terms

Tap a card to flip it. 0/4 known

Examples

Choosing sources for a 50-person company

The company fears three things: phishing, stolen passwords and ransomware. Step 1: map each threat to the logs that would show it. Phishing shows up in mail gateway logs and in DNS and proxy logs when someone clicks. Stolen passwords show up in Entra ID or VPN sign-in logs. Ransomware shows up in endpoint process logs (Sysmon or EDR) before files are encrypted. Step 2: collect those first, from every laptop and server. Step 3: add firewall logs for internet-facing systems. Step 4: write down what you are not collecting yet (for example database query logs), so gaps are a choice, not a surprise.

Forwarding Linux auth logs with rsyslog over TCP

A Linux server should send its login events to a central collector at 10.0.0.50. Step 1: add a forwarding rule that uses TCP and a disk-assisted queue, so messages wait instead of being lost when the collector is down. Step 2: check the config syntax. Step 3: restart rsyslog. Step 4: write a test message and search for it on the collector.

bash
# /etc/rsyslog.d/90-forward.conf
auth,authpriv.* action(type="omfwd" target="10.0.0.50" port="514" protocol="tcp"
                       queue.type="LinkedList" queue.filename="fwd_auth"
                       queue.saveOnShutdown="on" action.resumeRetryCount="-1")

# then, on the server:
sudo rsyslogd -N1                 # check config syntax
sudo systemctl restart rsyslog
logger -p auth.notice "forwarding test"

Quick reference

  • Windows: 4624 logon OK, 4625 logon failed, 4720 user created, 1102 Security log cleared
  • Turn on command-line logging so event 4688 shows what was run, not just the program name
  • Sysmon IDs: 1 process create, 3 network connection, 11 file create, 22 DNS query
  • Linux logins: /var/log/auth.log (Debian, Ubuntu) or /var/log/secure (RHEL family)
  • Syslog over UDP 514 can drop messages; prefer TCP, or TLS on port 6514
  • Daily volume is about events per second x average size x 86,400
  • Store UTC, sync clocks with NTP, and keep both event time and ingest time
  • CloudTrail event history covers 90 days; create a trail to keep logs longer

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1Which Windows event ID shows that the Security log was cleared?

Question 2

2Why is plain syslog over UDP a weak choice for security logs?

Question 3

3An old syslog line starts with Oct 11 22:14:15. What important information is missing?

Question 4

4A source sends 1,000 events per second averaging 1 KB each. Roughly how much raw data is that per day?

0/4 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    On a Linux machine, show the last 10 failed SSH logins and the last 5 successful ones.

  2. Exercise 2medium

    Write a one-page log source plan for a small web shop: one web server, one database, 20 laptops and Microsoft 365. For each source say what to collect, how it is forwarded, and why.

  3. Exercise 3hard

    Estimate storage: 300 laptops at 5 events per second each, 10 servers at 20 each, and a firewall at 400, average 600 bytes. Give raw GB per day, 90 days hot, and 12 months of archive at 10:1 compression.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Should I just collect every log I can?
No. Volume costs money and slows searches. Collect the sources that map to the attacks you care about, then add more as you find gaps.
What is the difference between Sysmon and the Windows Security log?
The Security log records logons, account changes and basic process starts. Sysmon adds detail such as file hashes, parent processes, network connections and DNS queries, which makes detections much stronger.
Do I need an agent on every machine?
For endpoints and servers, usually yes, because agents buffer, encrypt and resend. Network devices and many cloud services send logs by syslog or through an API connector instead.
How long should I keep security logs?
At least as long as any rule you follow requires, such as 12 months for PCI DSS, and long enough to cover how late intrusions are often found. Many teams keep 90 days searchable and a year or more in cheap archive storage.

Go deeper

ShareXLinkedInWhatsApp