Skip to Content
OpenVAPTAlpha
Pre-release. Academic, non-commercial, source-available code built by AI Cybersecurity Engineers. Free for your own use, 100% at your own risk. This website collects no data. Read MoreRead Less
Pre-release. OpenVAPT has no Stable release yet. Every build is an Alpha, Beta or Release Candidate: it may be incomplete or wrong, so use it only on test machines, 100% at your own risk. See Release Channels
Academic, non-commercial, source-available code built by AI Cybersecurity Engineers. These are AI systems, not people or registered engineers. Free for your own personal or business use, on your own machines, 100% at your own risk. Not for sale. Not for providing services. This website collects no data. Read the Acknowledgements
Pre-release. OpenVAPT has no Stable release yet. Every build is an Alpha, Beta or Release Candidate: it may be incomplete or wrong, so use it only on test machines, 100% at your own risk. See Release Channels
Academic, non-commercial, source-available code built by AI Cybersecurity Engineers. These are AI systems, not people or registered engineers. Free for your own personal or business use, on your own machines, 100% at your own risk. Not for sale. Not for providing services. This website collects no data. Read the Acknowledgements
P16PractitionerAbout 20 minutes

Logging, Auditing and Time

How logs, the audit daemon, synchronised time and log-driven blocking turn a server from a black box into something you can investigate and defend.

Read First: P1, P15

You Will Be Able To

  • Explain why logging is a control in its own right, not an afterthought.
  • Describe what makes logs useful after an incident: persistence, protection, rotation and correct time.
  • Explain what the audit daemon records that ordinary logs do not.
  • Explain how log-driven blocking and sudo and SSH logging settings turn records into defence.

Why Logs Are a Control

Most controls try to stop an attack. Logs are the control that tells you an attack happened, how far it got and what to fix.

Without logs there is no evidence. You cannot say which account was used, which files changed or when it started. Every later decision becomes a guess.

CIS Controls v8 gives this its own control, number 8, Audit Log Management. NIST CSF 2.0 calls it Continuous Monitoring (DE.CM). NIST SP 800-92 is the public guide to doing it well.

System Logs That Survive

Logs must survive a reboot. rsyslog and syslog-ng write to /var/log. The systemd journal keeps logs only in memory unless /var/log/journal exists.

Logs must also survive an attacker. Authentication logs hold user names, source addresses and sometimes passwords typed into the wrong field. Only administrators should read them.

Logs must not fill the disk. logrotate, or a SystemMaxUse limit for the journal, keeps them bounded. A full disk stops services and is itself an attack.

Where you can, send a copy to another machine. Logs that live only on the compromised server can be edited by whoever compromised it.

Auditing With auditd

Ordinary logs record what programs choose to say. The Linux audit daemon records what the kernel saw: a file opened, a permission changed, a privilege used.

Rules decide what auditd watches. Common choices are changes to /etc/passwd and /etc/shadow, use of sudo, and deletions by ordinary users.

Audit logs cost disk and attention. Start with a small rule set that answers the questions an investigation would ask, then grow it.

Time and Correlation

An investigation puts events from several sources in order. That only works if every clock agrees. A few minutes of drift can swap cause and effect.

chrony, ntpd or systemd-timesyncd keep the clock in step with public time servers. TLS certificates and one-time password codes also fail when the clock drifts.

From Logs to Action

A log-based blocker such as fail2ban, sshguard or CrowdSec reads the authentication log and blocks sources that fail repeatedly. The log becomes an active defence.

Sudo should log to its own file and use a pseudo-terminal, so every privileged command is recorded and sessions end cleanly.

SSH at LogLevel VERBOSE records the fingerprint of the key used for each login. That is how you learn which key, not just which user, opened the session.

In Summary

Logs are how you find out. Keep them after a reboot, keep them from other users, keep them bounded and keep the clock right. Add auditd for what the kernel sees. Let a blocker act on the log, and make sudo and SSH say who did what.

Apply It

These OpenVAPT checks put this module into practice. Open one to see its detection logic and source code.

Printable Worksheet · Teacher Answer Key · For Teachers · Print this page with your browser's Print command for a handout.

Also available as plain Markdown for notes, scripts and AI tools. Same facts, same source, no styling.

Lab

  1. Run: openvapt demo --only HOST-LOG-,HOST-IDS-,HOST-TIME-,HOST-SSH-012 --out p16
  2. For each failed check, write what question an investigator could no longer answer.
  3. Run: openvapt explain HOST-LOG-003 and note that the check reads file metadata only, never log contents.
  4. On your own machine: ls -l /var/log/auth.log /var/log/secure 2>/dev/null and timedatectl, then compare with the two checks.

Check Yourself

Answers are checked in your browser and never stored or sent.

Question 1

1. What is lost when the systemd journal is kept only in memory?

Question 2

2. Why should /var/log/auth.log not be readable by every user?

Question 3

3. What does auditd record that rsyslog does not?

Question 4

4. Why does time synchronisation matter for an investigation?

Question 5

5. What does a log-based blocker such as fail2ban do?

References

Cite This Page

If this page helped your work, please cite it. The version and web address are filled in; the access date is today's date in your browser. Every other style, and when credit is required, is on How to Cite OpenVAPT.

APA 7
OpenVAPT. (2026). P16: Logging, Auditing and Time (Version 0.1.0-alpha.6). OpenVAPT Academy. Retrieved October 16, 2026, from https://openvapt.com/academy/p16.html

In text: (OpenVAPT, 2026). Accessed: the date shown is today's date from your own browser (the site's build date without JavaScript); change it to the day you read the page.

BibTeX
@misc{openvapt_p16,
  author       = {{OpenVAPT}},
  title        = {{P16: Logging, Auditing and Time}},
  year         = {2026},
  howpublished = {\url{https://openvapt.com/academy/p16.html}},
  note         = {OpenVAPT Academy, version 0.1.0-alpha.6. Accessed 16 October 2026}
}

Accessed: the date shown is today's date from your own browser (the site's build date without JavaScript); change it to the day you read the page.

Citing OpenVAPT does not mean OpenVAPT endorses, approves or has reviewed your work.