Last updated: April 29, 2026
Detection requires visibility. Visibility requires logs. If your systems fall silent, you cannot investigate, cannot alert, cannot prove compliance. This module is about what to log, where to send it, and how to get real signal out of raw events.
The logging stack
- Generation — the system produces events (auth, syscalls, application logs)
- Collection — agents ship events from host to central pipeline
- Storage — long-term retention, searchable
- Analysis — alerts, dashboards, investigation workflows
- Response — action triggered on high-confidence signals
What to log (minimum for any production system)
- Authentication events — success, failure, logout
- Authorization events — privilege changes, failed access attempts
- Process execution — what ran, by whom, with what args
- Network — outbound connections, DNS queries
- Data access — sensitive file reads/writes, database queries
- Config changes — who changed what, when
- Application errors — unhandled exceptions, 5xx responses
A common failure mode: applications log only their own business events but miss the security-relevant ones above. Build logging into application design, not bolt it on later.
Linux: auditd + journald + syslog
# /etc/audit/rules.d/security.rules
# Watch privilege changes
-w /etc/passwd -p wa -k passwd_changes
-w /etc/shadow -p wa -k shadow_changes
-w /etc/sudoers -p wa -k sudoers_changes
-w /etc/sudoers.d/ -p wa -k sudoers_changes
# Watch sensitive config
-w /etc/ssh/sshd_config -p wa -k sshd_config
-w /etc/hosts -p wa -k hosts_changes
# Catch root-level command execution
-a always,exit -F arch=b64 -S execve -F uid=0 -k root_commands
# Catch privilege escalation (non-root running commands as root)
-a always,exit -F arch=b64 -S execve -F euid=0 -F auid!=0 -k privesc
# Watch log files themselves (attacker tampering)
-w /var/log -p rwa -k log_tamper
Load with augenrules --load or service restart. View events: ausearch -k privesc.
Windows: Event Log + Sysmon + WDAC audit
Advanced Audit Policy subcategories to enable (via GPO):
- Account Logon → Credential Validation: Success + Failure
- Account Management → User Account Management: Success + Failure
- Detailed Tracking → Process Creation: Success
- Logon/Logoff → Logon: Success + Failure
- Object Access → File Share: Success + Failure (for sensitive shares)
- Policy Change → Audit Policy Change: Success
- Privilege Use → Sensitive Privilege Use: Success + Failure
- System → Security State Change: Success
Plus Sysmon for process, network, file-hash, registry events (see Module 2).
Log aggregation platforms
| Tool | Strengths / best-fit |
|---|---|
| Splunk | Enterprise standard, expensive, exceptional search, rich ecosystem |
| Elastic (ELK) | Open source core, good for logs + APM, operational complexity |
| Sumo Logic | SaaS, good for cloud-native teams |
| Datadog | Unified logs + metrics + APM, SaaS, expensive at scale |
| Microsoft Sentinel | Cloud-native SIEM in Azure, integrates tightly with MDE/Entra |
| Wazuh | Free, open source, host-based IDS + SIEM, good for Indian SMBs |
| Loki + Grafana | Simple, low-cost, good for devops logs but weaker on security analytics |
Retention and compliance
- Authentication / privileged-access logs: 1 year minimum
- Network flow logs: 90 days
- Application logs: 30-90 days, longer for security-relevant
- Backup logs for 7 years for financial / regulated workloads (Indian Income-tax Act, RBI)
- Critical: logs older than retention window are deleted — document your policy; auditors will ask
Detection engineering — not just collection
Collecting logs without alerts is archaeology, not detection. Build detections aligned to MITRE ATT&CK techniques:
- T1078 Valid Accounts — alert on login from unusual geo, failed-then-success patterns
- T1098 Account Manipulation — alert on new account creation, group membership changes
- T1021.002 SMB/Windows Admin Shares — alert on remote SMB from non-admin stations
- T1003.001 LSASS Memory — alert on process access to LSASS
- T1547.001 Registry Run Keys — alert on writes to autorun keys
Build detections iteratively — start with the top 20 ATT&CK techniques for your environment. Tune false positives weekly. Retire rules that never fire.
Log integrity
Attackers delete or edit local logs. Defences:
- Ship logs off-host in real-time (syslog → SIEM immediately)
- Use append-only log storage where possible (S3 with Object Lock, SIEM immutable indexes)
- Hash logs periodically; alert on unexpected changes
- Centralise log collection to isolated account/VLAN that source hosts cannot reach
Common pitfalls
- Logs filling disks — rotate, monitor disk usage, alert before 80%
- Secrets in logs — passwords, tokens, PII. Use log scrubbers; review your own logs for leaks quarterly
- High-cardinality tags blowing up SIEM cost — be thoughtful about what to index vs archive
- Alerting fatigue — if analysts ignore alerts, you have no detection. Tune mercilessly
Quick reference summary
- Five-stage stack: generation → collection → storage → analysis → response
- Log what matters: auth, authz, process exec, network, data access, config changes
- Linux: auditd + journald + syslog shipped to SIEM
- Windows: Advanced Audit Policy + Sysmon + WEF/agent to SIEM
- SIEM: Splunk / Elastic / Sentinel / Wazuh (free)
- Retention: 1yr privileged, 90d flow, 30-90d app
- Build MITRE ATT&CK-aligned detections; iterate on false positives
- Log integrity: ship off-host, append-only storage, hash verification
Module Quiz · 20 questions
Pass with 80%+ to mark this module complete. Unlimited retries. Each question shows an explanation.
Custom team training + practitioner advisory
Beyond the free academy — we run private workshops, vCISO advisory, and red-team exercises tailored to your stack. For Indian SMBs scaling past their first hire.