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.
Continue reading with Basic tier (βΉ499/month)
You've read 30% of this module. Unlock the remaining deep-dive, quiz, and every other Intermediate module.