Logging and detection pipelines
From raw events to alerts you can trust
Follow a log from the system that makes it to the alert a person reads: what to record, how to store it safely, and how to tune detections.
beginner level, 18 minutes, 17 slides.
Logging and detection pipelines
Welcome. Follow a log from the system that makes it to the alert a person reads: what to record, how to store it safely, and how to tune detections. This talk runs about 18 minutes.
Logs are a system's memory
A log is a record of something that happened. Without logs you cannot tell what an attacker did. A detection pipeline turns those records into a warning.
When something goes wrong, the first question is always: what happened? Logs are how a system remembers. In this talk we follow a log from the moment it is written to the moment a person gets an alert, and we look at what can go wrong along the way.
The pipeline at a glance
Every stage can fail quietly. Watch all of them.
- Generate: Apps and systems write events
- Collect: Send to a central place
- Normalize: Same field names
- Store: Keep for a set time
- Detect: Rules look for patterns
- Alert: A person is told
Define: SIEM: A SIEM is a system that collects logs, stores them and runs detection rules over them.
Here is the whole pipeline. Systems generate events. We collect them in one place. We normalize them so the fields match. We store them. Detection rules look for patterns, and when one fires, a person gets an alert. NIST SP 800-92 covers building a log management infrastructure and running these processes. Remember that any stage can break silently, so we monitor the pipeline itself. OWASP also says to have processes that detect whether logging has stopped.
What to log
- Authentication successes and failures.
- Access control failures.
- Input validation failures.
- User administration and privilege changes.
- Use of admin or break-glass accounts.
- Start, stop and pause of logging itself.
No blind checklists: A checklist with no thought can cause alarm fog, where real problems go unnoticed.
OWASP gives a practical list of what to log: logins and failed logins, access control failures, validation failures, admin actions, and the starting and stopping of logging itself. It also warns that a blind checklist leads to alarm fog, so choose events that help you answer real questions.
What each event should say
Every event should answer: when, where, who and what.
| Question | Example fields |
|---|---|
| When | Event time, log time, interaction identifier |
| Where | Application name, host or address, service |
| Who | User identity, source address |
| What | Type, severity, description |
OWASP says each log entry must record when, where, who, and what. When is the time. Where is the application and host. Who is the user and their source address. What is the type, severity, and description of the event. Adding the action, the object, and the result makes events much easier to search later.
What not to log directly
OWASP says these should be removed, masked, hashed or encrypted, not logged as plain text:
- Authentication passwords.
- Database connection strings.
- Encryption keys and other primary secrets.
- Bank account or payment card data.
- Data the logging system is not allowed to store.
Log injection: Clean event data so attackers cannot insert fake lines using line breaks or delimiter characters.
Logs get copied to many places, so they should not contain secrets. OWASP says passwords, connection strings, keys, and payment card data should usually not be recorded directly, and should instead be removed, masked, hashed, or encrypted. Also sanitize what you log. Attackers can sneak in line breaks to forge fake log lines, a problem called log injection.
Clocks must agree
Rule: Synchronize time across all servers and devices.
- An attack touches many machines.
- Wrong clocks scramble the order of events.
- Record time in an international format.
If two servers disagree about the time, you cannot put events in order. That makes an investigation slow and sometimes impossible. OWASP says to synchronize time across all servers and devices, and to use an international format for dates and times.
Collection and normalization
Different systems name the same thing differently. Normalizing maps them to one set of field names.
One normalized event (illustrative field names; documentation IP)
{
"time": "2026-11-11T09:30:00Z",
"host": "web-01",
"user": "alice",
"action": "login",
"result": "failure",
"source_ip": "192.0.2.10"
}OWASP advises a standard format, or one that can be exported in an industry-standard format.
Normalizing means giving the same idea the same field name everywhere. One system calls it src, another calls it client address. After normalizing, both are source IP, and one rule can search them all. OWASP recommends recording data in a standard format where possible.
Retention: keep it, but not forever
OWASP guidance: Do not destroy log data before the required retention period, and do not keep it beyond that time.
- Retention is how long logs are stored.
- Legal, regulatory and contractual duties can set the period.
- Longer storage costs more, so size it.
Retention means how long you keep logs. Keep them at least as long as your requirements say, and do not keep them past that time. OWASP says legal, regulatory, and contractual obligations can affect the period. One of the labs at the end shows how to size storage for a retention requirement.
Detection rules with Sigma
Sigma is an open format for detection rules, written in YAML. One rule can be converted for many SIEMs.
A simple rule (illustrative app and field names). It fires on every failure.
title: Failed sign-in
logsource:
product: webapp
service: auth
detection:
selection:
action: login
result: failure
condition: selection
falsepositives:
- Users who forgot their password
level: lowA detection rule says: when events look like this, raise a flag. Sigma is an open format for writing those rules in YAML, and a single rule can be converted into a query for the SIEM you use. Notice the false positives field. Sigma rules can carry that metadata, along with a level for severity, so the person reading the alert has context. This simple rule fires on every failed sign-in, so a real rule would add a count over time in your SIEM.
Good alerts versus noisy alerts
Noisy
- Fires on every single event
- No owner, no next step
- Analysts learn to ignore it
Useful
- Fires on a meaningful pattern
- Lists known false positives
- Has a clear owner and action
Ask of every alert: If this fires at 3 a.m., what should the person do?
An alert nobody trusts is worse than none, because people start ignoring all of them. A useful alert fires on a meaningful pattern, says what normally causes false alarms, and has a clear next step. Before you turn a rule on, ask what the person will do when it fires.
The detect and tune loop
Detection is never finished.
- Write: A rule for a behavior
- Test: Run on sample logs
- Deploy: Turn it on
- Review: Count real and false alerts
- Tune: Narrow or fix the rule
Detection is a loop. Write a rule, test it on sample logs, deploy it, review what it caught, and tune it. Each pass makes the rule quieter and more accurate. The Sigma guide recommends keeping all your rules in one detections-as-code repository, which makes deployment simpler. The detection-as-code lab shows how.
Protect the logs themselves
- Build in tamper detection for changed or deleted records.
- Store logs on read-only media.
- Send logs over secure protocols.
- Record and monitor all access to the logs.
- Detect when logging has stopped.
Attackers often try to erase their tracks, so logs need protection. OWASP lists the basics: tamper detection, read-only media, secure transport, monitored access, and a way to notice when logging stops. A log you cannot trust is not evidence.
Check your understanding
Check yourself: Which should NOT be written to a log in plain text?
Answer: Authentication passwords. OWASP lists authentication passwords, connection strings, keys and payment card data as data that should not be recorded directly.
Check yourself: Why synchronize clocks across servers?
Answer: To put events from many machines in the right order. Without agreed time you cannot reliably order events across systems.
Two questions to test yourself. Pause, think, then reveal.
Recap
- Log the events that answer real questions.
- Record when, where, who and what.
- Keep secrets out of logs; sync clocks.
- Write rules, test them, and tune them often.
- Protect logs from tampering.
To recap: log what matters, make each event answer when, where, who and what, keep secrets out, sync clocks, tune your rules in a loop, and protect the logs themselves. Pick a lab and try it for real.
Practise this
- Write your first Sigma detection rule
- Size log storage for a retention requirement
- Ship tamper-evident logs off-box over mutual-TLS syslog, then prove a deletion is detectable
- Build a detection-as-code pipeline: unit-test your Sigma rules and gate them in CI
Slides only get you so far. Pick one of these hands-on labs and do it today while it is fresh. Every lab is free.
Sources
- NIST SP 800-92: Guide to Computer Security Log Management
- OWASP Logging Cheat Sheet
- Sigma: Getting Started
Every claim in this deck came from these pages, fetched and checked for this release. Read the originals.
Hands-on labs for this deck
- Write your first Sigma detection rule
- Size log storage for a retention requirement
- Ship tamper-evident logs off-box over mutual-TLS syslog, then prove a deletion is detectable
- Build a detection-as-code pipeline: unit-test your Sigma rules and gate them in CI
Open the interactive deck or see all slide decks.