UnixDroid

Lesson 2 of 5 · 7 min

Logs: where the evidence lives

The Linux log files and Windows event IDs every analyst checks first, and how to read one line properly.

Attackers can hide many things, but almost everything they do leaves a line in a log somewhere. Knowing where to look is half of a SOC analyst's job.

The main Linux log files and Windows security event IDs
The main Linux log files and Windows security event IDs

Linux logs

On Debian-based systems (Ubuntu, Kali), the classic files live in /var/log/:

FileWhat it records
/var/log/auth.logLogins, SSH, sudo use
/var/log/syslogGeneral system messages
/var/log/apache2/access.logEvery request to an Apache web server

Newer systems, including recent Kali releases, may not create auth.log at all, because they log to the systemd journal instead. You read it with journalctl:

sudo journalctl -u ssh            # only the SSH service
sudo journalctl --since "1 hour ago"
sudo journalctl _COMM=sudo        # only sudo messages

Reading one line

Here's a typical failed SSH login:

Nov 19 10:42:11 lab sshd[1432]: Failed password for root from 203.0.113.45 port 51234 ssh2
PartMeaning
Nov 19 10:42:11When it happened
labWhich machine logged it
sshd[1432]The program and its process ID
Failed password for rootWhat happened, and to which account
from 203.0.113.45Where the attempt came from

Windows logs

Open Event Viewer → Windows Logs → Security. Every event has an ID number, and a handful of them come up constantly:

Event IDMeaningWhy you care
4624Successful logonWho got in, and how
4625Failed logonMany in a row = password guessing
4688New process createdWhat ran on the machine
4720User account createdAttackers love new accounts
1102Security log clearedAlmost always suspicious

Inside a 4624 event, check the Logon Type: 2 is someone at the keyboard, 3 is over the network, and 10 is Remote Desktop.

If you ever see event 1102 and nobody can explain it, treat it as an incident. Someone wanted the history gone.

Try it yourself
  1. On Kali, run sudo journalctl -u ssh --since today. If SSH isn't running, start it with sudo systemctl start ssh first.
  2. On a Windows PC, open Event Viewer, select the Security log, click Filter Current Log and enter 4624. Open one event and find its Logon Type.
  3. Write down one line from each and label every part, like the table above.
No Linux machine? Practise in the free online terminal

Quick check

Which Windows event ID means a failed logon?

Need a hint?

It is one more than a successful logon.

Finished this lesson?

Done lessons keep your daily streak going 🔥

0 day streak

0 lessons done

best 0 days

Log in to keep your streak on every device →