hack3rs.ca network-security
/learning/linux-windows-logging-basics-for-defenders :: module-3

student@hack3rs:~/learning$ open linux-windows-logging-basics-for-defenders

Linux and Windows Logging Basics for Defenders

Introduce host logging as the other half of network defense. This module covers what logs exist, what they are good for, and how to collect enough data for investigations without drowning in noise.

Network alerts often require host context to confirm activity, determine impact, and identify the account or process involved. Without reliable host logs, investigations stall or rely on assumptions.

learning-objectives

  • $Identify key Linux and Windows log sources used in basic security investigations.
  • $Distinguish operational logs from security-relevant telemetry.
  • $Define a minimum baseline logging set for endpoints and servers.
  • $Normalize timestamps, hostnames, and user identities across sources.

example-dataflow-and-observation-paths

Use these example dataflows to trace how activity moves through systems and where a defender can observe evidence. This is how learners move from memorizing terms to thinking like investigators.

  • $User login attempt -> OS authentication subsystem -> auth/security log event -> centralized log forwarder -> SIEM/case timeline enrichment.
  • $Network alert fires -> analyst checks destination and timestamp -> host logs identify process and user -> triage decision becomes evidence-based instead of speculative.
  • $Time synchronization path: NTP -> system clock -> event timestamps -> centralized ingestion -> timeline reconstruction reliability.

baseline-normal-before-debugging

  • $Authentication events include consistent timestamps, hostnames, and user identifiers.
  • $Centralized logs arrive in order with minimal delay and preserved source context.
  • $Routine admin activity can be correlated between host logs and network timing.
Expert tip: Baseline normal behavior before writing detections or escalating anomalies. Most tuning and triage errors come from skipping this step.

concept-breakdown-and-mastery

1. Linux Logging Fundamentals

$ core idea: Linux systems commonly log through journald and/or syslog. Security-relevant sources include authentication events, sudo usage, SSH activity, service logs, kernel messages, and web server access/error logs.

$ defender angle: Defenders should understand how distro differences affect log locations and formats. For example, auth events may appear in different files depending on platform and configuration. Always verify actual logging paths in the environment instead of relying on memory.

$ prove understanding: Identify key Linux and Windows log sources used in basic security investigations.

2. Windows Event Logging Fundamentals

$ core idea: Windows Event Viewer exposes multiple channels, including Security, System, Application, PowerShell, and Sysmon (if deployed). Security defenders should prioritize account logons, privilege changes, process execution, scheduled tasks, and PowerShell activity.

$ defender angle: Windows logging can be noisy. Start with a baseline and known detection goals rather than enabling every possible source with no plan. Event IDs are useful, but context (host role, user role, time, parent process) is what makes them actionable.

$ prove understanding: Distinguish operational logs from security-relevant telemetry.

3. Host Logs + Network Logs = Defensible Investigations

$ core idea: Pair network evidence (destination, protocol, timing) with host evidence (process, user, command, service) to avoid false confidence. A connection to a suspicious domain means more when you know which process created it and under which account.

$ defender angle: Create a minimal logging baseline before tuning detections. It is better to have consistent, high-value logs from all critical systems than highly verbose logging on only a few machines.

$ prove understanding: Define a minimum baseline logging set for endpoints and servers.

deep-dive-notes-expanded

Work through the sections in order. For each section, learn the theory, identify normal behavior, identify failure patterns, then validate with packet/log/CLI evidence.

1. Linux Logging Fundamentals

Linux systems commonly log through journald and/or syslog. Security-relevant sources include authentication events, sudo usage, SSH activity, service logs, kernel messages, and web server access/error logs.

Defenders should understand how distro differences affect log locations and formats. For example, auth events may appear in different files depending on platform and configuration. Always verify actual logging paths in the environment instead of relying on memory.

Retention and forwarding matter as much as collection. A local log that rotates away before you investigate is operationally equivalent to no log.

Normal Behavior

Authentication events include consistent timestamps, hostnames, and user identifiers.

Failure / Abuse Pattern

Missing or delayed logs break timelines and reduce confidence in incident scoping.

Evidence To Collect

Identify key Linux and Windows log sources used in basic security investigations.

2. Windows Event Logging Fundamentals

Windows Event Viewer exposes multiple channels, including Security, System, Application, PowerShell, and Sysmon (if deployed). Security defenders should prioritize account logons, privilege changes, process execution, scheduled tasks, and PowerShell activity.

Windows logging can be noisy. Start with a baseline and known detection goals rather than enabling every possible source with no plan. Event IDs are useful, but context (host role, user role, time, parent process) is what makes them actionable.

Centralized collection and time synchronization are essential. Cross-host investigations fail quickly when timestamps drift or machine names are inconsistent.

Normal Behavior

Centralized logs arrive in order with minimal delay and preserved source context.

Failure / Abuse Pattern

Time drift across hosts makes sequences appear inconsistent or impossible.

Evidence To Collect

Distinguish operational logs from security-relevant telemetry.

3. Host Logs + Network Logs = Defensible Investigations

Pair network evidence (destination, protocol, timing) with host evidence (process, user, command, service) to avoid false confidence. A connection to a suspicious domain means more when you know which process created it and under which account.

Create a minimal logging baseline before tuning detections. It is better to have consistent, high-value logs from all critical systems than highly verbose logging on only a few machines.

Document collection gaps by system role: domain controllers, VPNs, firewalls, jump hosts, application servers, and admin workstations should each have defined logging expectations.

Normal Behavior

Routine admin activity can be correlated between host logs and network timing.

Failure / Abuse Pattern

High-value systems log locally only and rotate before analysts can collect evidence.

Evidence To Collect

Define a minimum baseline logging set for endpoints and servers.

terminal-walkthroughs-with-example-output

These walkthroughs show representative commands plus example output so learners know what success and useful evidence look like. Treat the output as a pattern guide, not a fixed transcript.

Linux Logging Basics

Beginner
Command
journalctl -n 100 --no-pager
Example Output
... sshd[1234]: Accepted publickey for analyst
... sudo: analyst : COMMAND=/usr/bin/systemctl status ssh

$ why this matters: Use this step to validate linux logging basics before moving on to more advanced commands in the same block. Focus on interpreting the output, not just running the command.

Windows Event Log (PowerShell)

Intermediate
Command
Get-WinEvent -LogName Security -MaxEvents 20
Example Output
TimeCreated              Id  ProviderName
-----------              --  ------------
...                      4624 Microsoft-Windows-Security-Auditing

$ why this matters: Use this step to validate windows event log (powershell) before moving on to more advanced commands in the same block. Focus on interpreting the output, not just running the command.

Cross-Source Timeline Prep

Advanced
Command
timedatectl status
Example Output
# command executed in lab
# review output for expected fields, errors, and anomalies

$ why this matters: Use this step to validate cross-source timeline prep before moving on to more advanced commands in the same block. Focus on interpreting the output, not just running the command.

cli-labs-and-workflow

Run these commands only in environments you own or are explicitly authorized to test. Use a lab VM, sandbox network, or approved internal test segment for practice.

Linux Logging Basics

Beginner
journalctl -n 100 --no-pager
journalctl -u ssh --since '1 hour ago'
sudo tail -f /var/log/auth.log
sudo grep -i 'failed' /var/log/auth.log | tail

Run in a lab or authorized environment. Record what fields change when you alter the test conditions.

Windows Event Log (PowerShell)

Intermediate
Get-WinEvent -LogName Security -MaxEvents 20
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4624} -MaxEvents 10
Get-WinEvent -LogName Microsoft-Windows-PowerShell/Operational -MaxEvents 20

Run in a lab or authorized environment. Record what fields change when you alter the test conditions.

Cross-Source Timeline Prep

Advanced
timedatectl status
hostnamectl
date -u

Run in a lab or authorized environment. Record what fields change when you alter the test conditions.

expert-mode-study-loop

  • $Explain the concept in plain language without reading notes.
  • $Show how to validate the concept with logs, packets, or commands.
  • $Name at least one common failure mode and how to detect it.
  • $Document what 'normal' looks like before testing edge cases.
Progress marker: You are ready to move on when you can explain the topic, run the commands, and interpret the output without guessing.

knowledge-check-and-answer-key

Try answering these from memory before looking at the hints. These questions are designed to test understanding of concepts, dataflow, and evidence collection.

1. Linux Logging Fundamentals

Questions
  • ?How would you explain "Linux Logging Fundamentals" to a new defender in plain language?
  • ?What does normal behavior look like for linux logging fundamentals in your lab or environment?
  • ?Which logs, packets, or commands would you use to validate linux logging fundamentals?
  • ?What failure mode or attacker abuse pattern matters most for linux logging fundamentals?
Show answer key / hints
Answer Key / Hints
  • #Identify key Linux and Windows log sources used in basic security investigations.
  • #Authentication events include consistent timestamps, hostnames, and user identifiers.
  • #journalctl -n 100 --no-pager
  • #Missing or delayed logs break timelines and reduce confidence in incident scoping.

2. Windows Event Logging Fundamentals

Questions
  • ?How would you explain "Windows Event Logging Fundamentals" to a new defender in plain language?
  • ?What does normal behavior look like for windows event logging fundamentals in your lab or environment?
  • ?Which logs, packets, or commands would you use to validate windows event logging fundamentals?
  • ?What failure mode or attacker abuse pattern matters most for windows event logging fundamentals?
Show answer key / hints
Answer Key / Hints
  • #Distinguish operational logs from security-relevant telemetry.
  • #Centralized logs arrive in order with minimal delay and preserved source context.
  • #Get-WinEvent -LogName Security -MaxEvents 20
  • #Time drift across hosts makes sequences appear inconsistent or impossible.

3. Host Logs + Network Logs = Defensible Investigations

Questions
  • ?How would you explain "Host Logs + Network Logs = Defensible Investigations" to a new defender in plain language?
  • ?What does normal behavior look like for host logs + network logs = defensible investigations in your lab or environment?
  • ?Which logs, packets, or commands would you use to validate host logs + network logs = defensible investigations?
  • ?What failure mode or attacker abuse pattern matters most for host logs + network logs = defensible investigations?
Show answer key / hints
Answer Key / Hints
  • #Define a minimum baseline logging set for endpoints and servers.
  • #Routine admin activity can be correlated between host logs and network timing.
  • #timedatectl status
  • #High-value systems log locally only and rotate before analysts can collect evidence.

lab-answer-key-expected-findings

Use this as a baseline answer key for labs and walkthroughs. Replace these with environment-specific observations as you practice in real or simulated networks.

Expected Normal Findings
  • +Authentication events include consistent timestamps, hostnames, and user identifiers.
  • +Centralized logs arrive in order with minimal delay and preserved source context.
  • +Routine admin activity can be correlated between host logs and network timing.
Expected Failure / Anomaly Clues
  • !Missing or delayed logs break timelines and reduce confidence in incident scoping.
  • !Time drift across hosts makes sequences appear inconsistent or impossible.
  • !High-value systems log locally only and rotate before analysts can collect evidence.

hands-on-labs

  • $Generate a test SSH login and failed login on Linux and locate the related records.
  • $Generate a Windows test logon and a PowerShell command, then identify relevant Event IDs/channels.
  • $Map one network alert to host logs to identify process/user/source of activity.

common-pitfalls

  • $No time sync (NTP) leading to broken timelines.
  • $Collecting logs without retention or centralization.
  • $Turning on verbose logging everywhere without a parsing/search plan.

completion-outputs

# A baseline host logging checklist by OS and role
# A simple timeline worksheet combining host and network events
# A gap list for systems missing centralized logging
<- previous page Subnetting, NAT, Firewall Policy Logic, and Segmentation Basics -> next page Packet Capture and Protocol Analysis with Wireshark / TShark
learning-path-position

Foundations / Weeks 1-2 · Module 3 of 12