Logging, SIEM, and Detection Engineering
Build visibility that answers real questions, write detections that explain themselves, and tune alerts so responders trust them.
By the end, you’ll be able to…
- Identify high-value log sources and the questions they can answer.
- Explain how a SIEM normalises, correlates, and alerts on events.
- Write a detection rule with a clear hypothesis, logic, and response.
- Reduce false positives without hiding real malicious behaviour.
01Visibility Starts With Questions
A security operations centre cannot investigate what it cannot see. Logging is often collected because a tool offers it, not because anyone defined a question. Start with the questions responders need to answer: who logged in, from where, to what, and what did they do? Was MFA satisfied? Did a privileged account change permissions? Did a workload contact an unusual destination? Did a security control fail or get disabled?
High-value sources usually include identity providers, endpoint detection and response, DNS, web proxies, firewalls, cloud audit logs, Kubernetes audit logs, source control, CI/CD, and the application's own security events. Each source has different retention, latency, and blind spots. A perfect endpoint log does not help if the attacker only used a cloud API. A cloud trail does not show what happened inside a workload.
Collect the fields that make an event useful: timestamp in UTC, actor, source address, device, resource, action, outcome, and a stable event identifier. Preserve the raw event and the normalised version. Normalisation makes correlation possible; raw events preserve details that a parser might drop. Document the pipeline so analysts know how a log became an alert.
02The SIEM Is a Correlation Engine, Not a Magic Box
A security information and event management system ingests logs, parses them into fields, stores them, and runs rules or analytics. It can correlate events across sources: a failed login from a new country, followed by a successful login, followed by a mailbox rule that forwards email. The correlation is only as good as the ingested data and the logic a human wrote.
Detection engineering is a product discipline. A detection starts with a hypothesis about attacker behaviour, maps to observable telemetry, defines the logic, and specifies the expected response. It is tested against benign and malicious samples, measured for false positives, and reviewed as the environment changes. A rule that fires constantly and is ignored is worse than no rule because it trains responders to dismiss alerts.
Use frameworks to communicate coverage. MITRE ATT&CK describes adversary tactics and techniques, helping you ask which behaviours you can detect. The NIST Cybersecurity Framework provides a higher-level view of identify, protect, detect, respond, and recover. Neither is a checklist that guarantees safety. They are shared vocabularies for prioritising gaps.
title: Repeated failed logins followed by successid: 8f2c5f0e-examplestatus: experimentaldescription: Detects a burst of failed authentication followed by a success from the same source within ten minutes.logsource: product: identity service: signindetection: failed: outcome: failure success: outcome: success timeframe: 10m condition: failed | count() by source.ip > 10 and successfields: - user.name - source.ip - outcomefalsepositives: - Misconfigured client retrying an old password - Shared NAT with many legitimate userslevel: mediumtags: - attack.credential_access - attack.t1110Rule loaded. Test against 30 days of data: matches: 14 unique sources: 3 known benign: 11 (shared office NAT) review required: 3
03Tune for Trust
False positives are not just noise; they are a reliability problem. When analysts learn that an alert is usually wrong, they stop investigating carefully. Tune rules with context: exclude known health-check accounts, allow for shared NAT, baseline normal administrative hours, and require multiple signals for high-severity alerts. Do not simply suppress an alert because it is inconvenient. Understand why it fires.
False negatives are harder to see. Test detections with representative attack simulations in a lab, review incidents that were missed, and map coverage against the techniques that matter to your organisation. Track mean time to detect, mean time to acknowledge, alert-to-incident conversion, and analyst time per alert. These metrics reveal whether detection work is improving outcomes or just producing more dashboards.
Every alert should have a runbook: what it means, what to check first, how to contain it, who to escalate to, and how to close it. The responder should not have to reverse-engineer the rule during an incident. A detection without a response path is only a notification.
04Logging Is a Security Control
Logs contain sensitive data. They can include credentials, tokens, personal information, and internal architecture. Protect them with access control, encryption, retention limits, and redaction. Do not log full request bodies, passwords, session cookies, or payment data. If you need to debug a payload, use a controlled, time-limited process with appropriate approval.
Logs must also be reliable. Clock synchronisation, persistent storage, forwarding, and capacity planning matter. An attacker who fills the disk or disables the agent can erase visibility. Monitor the logging pipeline itself: missing heartbeats, parsing failures, sudden volume drops, and changes to retention settings are security events. The absence of logs is not the absence of activity.
Finally, test the whole path. Generate a known event, confirm it reaches the SIEM, confirm the field extraction is correct, confirm the rule fires, and confirm the alert reaches the on-call responder. A detection that works in a query console but not in production is not a detection. This end-to-end test is one of the highest-value exercises a security team can run.
The ideas worth keeping.
- Start logging with the questions responders need to answer, not with tool defaults.
- A SIEM correlates data, but detection quality depends on human-designed, tested logic.
- Every alert needs a runbook and a measurable response path.
- Protect logs as sensitive data and monitor the pipeline for silent failure.
Make it yours.
Type and test your code right here in the interactive workspace. Run your solution, check the output, and compare with the worked guide when ready.
Exercise 1: Design a detection
Write a detection hypothesis for an attacker creating a new cloud administrator account, including the telemetry, logic, false positives, and response.
Explore a worked solution
Hypothesis: if an attacker compromises a cloud identity and attempts persistence, they may create a new user or role with administrative permissions. Telemetry: cloud audit logs for CreateUser, CreateRole, AttachUserPolicy, and AddUserToGroup, with actor, target, source IP, user agent, and time. Logic: alert when a new identity is granted administrator-level policy outside an approved change window, especially from a new source or by an actor who has not done so before. False positives: approved automation, break-glass procedures, and infrastructure-as-code deployments. Response: verify the change with the owner, disable the new identity if unapproved, review the actor's recent activity, rotate credentials, and check for other persistence.A detection hypothesis names the behaviour, the telemetry, the logic, and the response. It is testable and can be tuned with real change data.
Exercise 2: Tune a noisy alert
A rule alerts on more than five failed logins from one IP in five minutes. It fires constantly because a shared office NAT generates legitimate failures. Describe three tuning approaches and the risk of each.
Explore a worked solution
1. Raise the threshold or extend the window, reducing noise but potentially missing slow password guessing; combine with a success signal. 2. Exclude known office egress ranges after verifying ownership, reducing noise but creating a blind spot if an attacker uses the same range; monitor those ranges with a different rule. 3. Correlate with other signals such as a subsequent success, a new user agent, or access to many accounts, improving precision but requiring additional telemetry. Document each exclusion and review it regularly.Tuning trades sensitivity for precision. The right approach depends on the environment and the behaviour you are trying to detect.
What stayed with you?
Check the ideas while they’re fresh. Your answers stay in this page and feedback appears as you go.
Keep exploring.
The official references behind this lesson, when you want a second angle or the full details.
One lesson closer.
Reading is a start. Trying it yourself makes the connection.