Live lesson · progress saved to your account

Security Monitoring & Logs

If it isn't logged, it didn't happen. Learn which log sources matter, read syslog, Windows events, JSON and CEF, centralise logs into a SIEM, hunt with search queries and write Sigma detections, then rebuild a 200-day breach timeline.

intermediate110 minwalkthrough

Anyone can read this lesson. To submit answers and earn XP, create a free account.

TASK 01Mission briefing: 200 days, zero alerts

INCIDENT NOTICE · DukaanMart (fictional), Pune · 140 stores · card data breach "A card network flagged fraud on cards used at our tills. Forensics says the attacker was inside for about 200 days. Our servers logged almost everything. Nobody was looking."

DukaanMart's problem wasn't a lack of data. Every attacker step left a trace in some log, but the logs sat on individual machines, nobody reviewed them, and nothing raised an alert. That is OWASP A09:2025 Security Logging & Alerting Failures in its purest form.

Press play and compare the two worlds:

200 days in the logs, 0 people reading them logs only
Day 0Day 0Day 200
d000proxy GET https://vpn-dukaanmart.example-login.com/ 200 user=r.kulkarniunread

Latest attacker step

Phishing page steals a store manager's VPN password

1 of 7 steps logged · 0 alerts

The time between an attacker getting in and the defender noticing is called dwell time. Security monitoring exists to shrink it from months to minutes. In this room you will build the monitoring DukaanMart lacked: pick the right log sources, read their formats, centralise them, search them in a SIEM, write detections and finally rebuild the breach timeline.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

TASK 02What to log

You can't monitor what you don't collect, and you can't afford to collect everything forever. Start with the sources that answer who did what, when, from where, and did it work:

Where the evidence lives click a source

Sample event · Endpoints

4688 New process: powershell.exe -enc JABzAD0A… parent=winword.exe

Answers: What ran on the device, who ran it, and what started it.

Every useful log answers who, what, when, where (from) and outcome. A log without a reliable timestamp or user is almost useless in an investigation.

A practical priority list for a company like DukaanMart:

  1. Identity: Active Directory / SSO logons, failures, MFA, new accounts, group changes (Room 12).
  2. Endpoints: process creation with command lines (Windows 4688 or Sysmon Event ID 1), plus EDR telemetry.
  3. Perimeter: firewall allow/deny, VPN, web proxy and DNS queries.
  4. Servers: Linux /var/log/auth.log (Debian/Ubuntu) or /var/log/secure (RHEL), Windows Security log.
  5. Cloud control plane: AWS CloudTrail, Azure Activity Log, Google Cloud Audit Logs.
  6. Applications: logins, exports, refunds, role changes. Only the app knows that a user exported 184,220 customer records.

Key Windows Security event IDs worth memorising:

IDMeaning
4624 / 4625Successful / failed logon
4672Special (admin) privileges assigned to a logon
4688New process created
4720User account created
4728 / 4732Member added to a security-enabled global / local group
7045New service installed (System log)
1102Security audit log cleared

Never log secrets: passwords, full card numbers, OTPs and session tokens must not end up in logs. Logs are copied widely and kept for a long time.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 03Log formats and the time zone trap

The same event looks completely different depending on who wrote it. A SIEM has to understand all of them:

One failed login, five formats click a field

Syslog (BSD / RFC 3164)

Dec 1 02:14:07 dmart-web01 sshd[2231]: Failed password for deploy from 203.0.113.77 port 51122 ssh2

Classic /var/log/auth.log. Local time, no year and no time zone: you must know the server's clock settings.

Syslog (RFC 5424)

<38>1 2026-11-30T20:44:07Z dmart-web01 sshd 2231 - - Failed password for deploy from 203.0.113.77

<38> is PRI = facility 4 (auth) × 8 + severity 6 (info). ISO 8601 time with a zone (Z = UTC).

Windows EVTX (XML view)

<EventID>4625</EventID> <TimeCreated SystemTime='2026-11-30T20:44:07.512Z'/> <Computer>DMART-WEB01</Computer> <Data Name='TargetUserName'>deploy</Data> <Data Name='IpAddress'>203.0.113.77</Data> <Data Name='Status'>0xC000006D</Data>

Binary .evtx files, shown here as XML. Event 4625 = failed logon. SystemTime is always UTC.

JSON (structured)

{"@timestamp":"2026-11-30T20:44:07Z","host.name":"dmart-web01","user.name":"deploy","source.ip":"203.0.113.77","event.outcome":"failure"}

Every field is named, so no regex parsing. These names follow the Elastic Common Schema (ECS).

CEF (Common Event Format)

CEF:0|DukaanMart|EdgeGW|4.2|1001|Failed login|5|rt=Nov 30 2026 20:44:07 UTC dhost=dmart-web01 duser=deploy src=203.0.113.77 outcome=failure

A pipe-separated header (version|vendor|product|version|id|name|severity) then key=value extensions. Common from firewalls and appliances.

The time zone trap

02:14:07 IST on 1 December (UTC+05:30) is 20:44:07 UTC on 30 November. Same moment, different day. Store everything in UTC and sync every clock with NTP, or your timeline will lie.

  • Syslog is the Unix standard. The old BSD format (RFC 3164) has no year and no time zone. RFC 5424 adds ISO 8601 timestamps and structured data. Each message carries a PRI value = facility × 8 + severity, where severity runs from 0 (Emergency) to 7 (Debug). Syslog traditionally travels over UDP 514 (unencrypted, can drop messages); use TCP or TLS (port 6514) for anything important.
  • Windows Event Logs are stored as binary .evtx files (Security, System, Application, plus channels like Sysmon). Event Viewer, PowerShell Get-WinEvent and SIEM agents read them.
  • JSON is self-describing: every value has a name, so parsing is reliable. Most cloud and modern app logs are JSON.
  • CEF (Common Event Format) and LEEF are vendor formats used by firewalls and appliances: a pipe-separated header followed by key=value pairs.

Time is the most important field and the easiest to get wrong. India is UTC+05:30, with no daylight saving. If one server logs IST and another logs UTC, events will appear 5½ hours apart. Rules of thumb: store in UTC, display in local time, and keep every clock synced with NTP. CERT-In's 2022 directions require organisations in India to sync clocks to the NTP servers of NIC or NPL.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 04Hands-on: parse and filter mixed logs

Before any SIEM, an analyst's best friends are grep, awk, sort, uniq and jq. You've been handed three files copied from DukaanMart's web server: an SSH log in local IST, a web access log and an application log in JSON (UTC).

The classic pipeline that ranks attackers:

grep "Failed password" auth.log | awk '{print $(NF-3)}' | sort | uniq -c | sort -nr

Read it left to right: keep failed logins → print the 4th field from the end (the IP) → sort so duplicates sit together → count each run → sort by count, biggest first.

Lab · Parse the web server's logs 0/5 goals
analyst@dmart-soc: ~/case-2611
analyst@dmart-soc:~/case-2611$ logs copied from dmart-web01 · type 'help'
$

Investigation goals

Count every failed SSH password in auth.log

Rank source IPs by failed logins (uniq -c)

Find the successful login from the top IP

Find the file the scanner managed to download

Use jq to find the big data export

Hints: grep -c counts matching lines. uniq only merges adjacent duplicates, which is why you sort first. For the web log, look for a 200 response to the scanner. For JSON, jq -c 'select(.event=="bulk_export")' app.json.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+30 XP

TASK 05Centralisation, retention and integrity

Logs that stay on the machine that wrote them have three problems: nobody looks at them, they roll over and disappear, and an attacker with admin rights can delete them. Centralisation fixes all three.

From a device to an alert toggle the attacker

Sources

Windows, Linux, firewall, cloud, apps

Agent / forwarder

Winlogbeat, Wazuh agent, rsyslog, WEF

Parse + normalise

Raw text → common field names

Index + store

Hot for search, cold for retention

Correlation rule

Fail × 10 → success, same IP

Alert

Ticket to the SOC

Local log on DMART-DC01

12,480 events · 4625 ×50 · 4624 · 4720 · 4728 …

Central copy in the SIEM

12,480 events + 1102 · forwarded within seconds

write-once storage · SHA-256 hash chain ✓ intact

Forwarding logs off the machine is what makes them trustworthy: an attacker with admin rights can delete local logs.

SourceRaw fieldNormalised field
Windows 4625IpAddresssource.ip
sshd syslogfrom <ip>source.ip
Firewall CEFsrcsource.ip
Windows 4625TargetUserNameuser.name
Firewall CEFduseruser.name

Collection. An agent on each host reads local logs and forwards them: Splunk Universal Forwarder, Elastic Agent / Winlogbeat / Filebeat, the Wazuh agent, or rsyslog / syslog-ng on Linux. Windows also has a built-in, agentless option: Windows Event Forwarding (WEF). Network devices usually send syslog directly.

Normalisation. Each source names fields differently (IpAddress, src, rhost). Parsers map them to a common schema such as the Elastic Common Schema (ECS) or Splunk's Common Information Model (CIM), so one search finds source.ip everywhere.

Retention. Keep logs long enough to investigate slow attacks. NIST SP 800-92 is the classic guide to log management. In India, CERT-In's 2022 directions require service providers and organisations to keep logs of their ICT systems for a rolling 180 days, stored within India, and to report specified incidents within 6 hours. Many teams keep 30–90 days "hot" (fast search) and the rest in cheaper "cold" storage.

Integrity. Forward in near real time over TLS, store in write-once (WORM) or append-only storage, restrict who can delete, and hash or sign batches so tampering is detectable. Treat the log platform as a crown jewel: it is the first thing a careful attacker targets.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 06SIEM fundamentals: correlate and hunt

A SIEM (Security Information and Event Management) does four jobs: ingest logs from everywhere, normalise them, correlate events into alerts, and give analysts search and dashboards. Popular platforms include Splunk, Elastic Security, Microsoft Sentinel, IBM QRadar and the open-source Wazuh.

Correlation is the part that turns noise into signal. One failed logon is nothing. Fifty from the same IP followed by a success is a breach:

Brute force to breach: 50 failures, then a success move the threshold

Correlation engine · failures per source IP

Individually, each 4625 is noise. Only the pattern matters.

Common correlation patterns:

  • Threshold: N events in T minutes (brute force, port scans, mass file deletion).
  • Sequence: A then B from the same entity (failures → success; new account → added to admins).
  • Rare / first seen: a user logging in from a country or device never seen before.
  • Impossible travel: two logins too far apart to be physically possible in the time between them.

Now search DukaanMart's domain controller logs yourself. The query language works like Splunk's SPL: filters first, then pipes.

Lab · Hunt in DukaanMart's SIEM 0/4 goals · 62 events
Query syntax and examples

field=value (wildcards with *), field!=value, "free text", then pipes: stats count by field · stats dc(field) by field · sort -count · table f1 f2 · head 5 · dedup field. Fields: _time (IST), EventCode, user, src_ip, LogonType, target, host, message.

Hunt goals

Count failed logons (4625) by source IP

Find the successful logon from the brute-forcing IP

Find the account the attacker created

Find where the attacker tried to cover their tracks

Tip: keep results focused (10 rows or fewer) when proving a finding.

Hints: index=wineventlog EventCode=4625 | stats count by src_ip | sort -count, then search everything that IP did except failures. Then look for new accounts (4720) and the log-clearing event.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+30 XP

TASK 07Writing detections with Sigma

Every SIEM has its own query language. Sigma is the open, vendor-neutral format for detection rules: write the logic once in YAML, then convert it to Splunk, Sentinel, Elastic and others with pySigma / sigma-cli. The community rule set lives at SigmaHQ on GitHub.

Anatomy of a Sigma rule click a line

detection

Field-value matches. 'selection' is just a label; 'condition' combines selections with and / or / not.

Write once, convert to any SIEM

index=wineventlog EventCode=4625
| bin _time span=5m
| stats count by _time, IpAddress
| where count >= 10

Converted with pySigma / sigma-cli backends. Field names are mapped per SIEM.

A Sigma rule has:

  • logsource: which logs (product, service or category).
  • detection: named selections of field/value matches, and a condition combining them (selection and not filter).
  • level, status, falsepositives, tags such as ATT&CK technique IDs.
  • Correlation rules (event_count, value_count, temporal) count or sequence matches of other rules, grouped by a field, within a timespan.

Good detections are specific, tested against real data and tuned. Too broad and analysts drown in false positives until they ignore the alert. Too narrow and the attacker walks past. Brute force maps to ATT&CK T1110.

Build and tune the brute-force rule for DukaanMart, then test it:

Lab · Write a Sigma rule for brute force tune, then test

logsource.product

EventID

group-by

timespan

condition gte

title: Failed logon
name: failed_logon
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID: 4624
  condition: selection
---
title: Brute force or spray from one source
correlation:
  type: event_count
  rules:
    - failed_logon
  timespan: 24h
  condition:
    gte: 3
level: high

Context: across the whole network, staff mistype passwords about 2–3 times a minute in total.

Hint: think about what each attack has in common (one source IP), how fast it happens, and how much normal noise there is.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+30 XP

TASK 08Final mission: rebuild the timeline

The CISO wants two things on one page: what happened, in order, and which three detections would have caught it on day one instead of day 200.

Your evidence comes from three systems. The firewall and proxy log in UTC; the domain controller logs in IST. Convert before you sort.

Final mission · Rebuild the timeline, write the detections IST · UTC+05:30

1. Click the events in the order they really happened. Watch the time zones.

2. Pick the three detections that would have caught this on day one.

Once detections exist, they belong on a dashboard the SOC watches every shift: failed vs successful logons over time, top source IPs, new privileged accounts and log-source health (a source that suddenly goes silent is an alert too). In the next room you'll work those alerts as a SOC analyst.

Complete the mission for the Log Whisperer badge and the room's XP.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+30 XP