Tuesday, April 21, 2026
Cohort 3 | Project CloudIgnite Topics: System Logs, Bash Scripting, Intro to Networking & OSI Model Duration: ~3 hours
📌 CLF-C02 Relevance sections are marked throughout. This lecture covers foundational Linux sysadmin skills and networking concepts that underpin the AWS Certified Cloud Practitioner exam.
Key Takeaways
- System logs stored in
/var/log/; severity levels from Emergency (0) to Debug (7) - Key log files:
syslog,secure(Red Hat),auth.log(Ubuntu),kern.log,httpd/ - Bash challenge: Auto-incrementing file creator using
wc -land$(ls | wc -l) - OSI Model: 7 layers — focus on Layer 7 (Application), Layer 4 (Transport), Layer 3 (Network)
- Network basics: Node, client, server, LAN, switch, router, modem, MAC address
- Submarine cables carry data as light; IoT and satellite as alternatives
Table of Contents
- System Logs
- Bash Scripting — Challenge Lab Walkthrough
- Introduction to Networking
- OSI Model
- CLF-C02 Exam Relevance Summary
1. System Logs
Why Logs Matter
Logs are the primary tool for understanding what is happening inside a system. Key use cases:
- Troubleshooting — server unreachable, app crashes, DB connection failures, high CPU
- Security audits — tracking who did what and when
- Compliance — many industries require logging all application activity
- Event tracking — user logins, logouts, and system events
Log Severity Levels (Lowest → Highest Priority)
| Level | Meaning |
|---|---|
| 0 — Emergency | System is unusable |
| 1 — Alert | Immediate action required |
| 2 — Critical | Critical condition |
| 3 — Error | Error condition |
| 4 — Warning | Warning condition |
| 5 — Notice | Normal but significant |
| 6 — Info | Informational |
| 7 — Debug | Debug-level detail |
⚠️ If a log shows Emergency, Alert, Critical, or Error — it requires immediate attention. Warning and below are less urgent.
Where Logs Are Stored (Linux)
All logs are stored in /var/log/
| Log File | Purpose |
|---|---|
syslog | General system information |
secure (Red Hat / Amazon Linux) | Security & authentication events |
auth.log (Debian / Ubuntu) | Authentication events |
kern.log | Kernel messages |
boot.log | System startup / boot events |
mail.log | Mail service logs |
/var/log/daemon | Background service (daemon) logs |
cron.log | Cron job execution logs |
/var/log/httpd/ | Apache web server logs (error & access) |
dmesg | Kernel ring buffer — hardware events (USB, devices); temporary/RAM-based |
lastlog | Last login time per user |
/var/log/yum.log | Package install/update history (Amazon Linux / Red Hat) |
💡 Amazon Linux is derived from Red Hat and uses
yum/dnfas the package manager. Debian/Ubuntu usesapt/dpkg.
Useful Log Commands
# View full log file
cat /var/log/syslog
# View last N lines (most recent)
tail -n 50 /var/log/syslog
# View first N lines
head -n 50 /var/log/syslog
# Scroll through large files
less /var/log/syslog
# Search for errors in a log
grep "error" /var/log/syslog
grep -i "critical\|error\|alert\|emergency" /var/log/syslog
# Write matching lines to a new file for investigation
grep "error" /var/log/syslog > errors_only.txt
# Check last login per user
lastlog
# Check sudo usage
grep "sudo" /var/log/secure
💡 Use
greporawkfor quick keyword searches — log files can be thousands of lines long. For servers without a GUI, these are your only options.
Log Rotation
- Logs can grow very rapidly, especially on high-traffic servers (every HTTP request is logged).
- Log rotation = automated cleanup process to keep log sizes manageable.
- You can write a cron job (bash script scheduled to run daily/weekly) to delete logs older than a set period (e.g., 7 days).
- Logs do not delete themselves automatically by default on most systems.
Security Investigation with Logs
- If an EC2 instance is compromised, check login logs (
lastlog,/var/log/secure) to trace attacker activity. - Use
su <username>to switch users;sudo passwd <username>to set a password. - Root access is needed to read sensitive logs — regular users cannot access
root's home or some system log folders.
2. Bash Scripting — Challenge Lab Walkthrough
Challenge: Auto-Incrementing File Creator
Goal: Write a bash script that:
- Creates 25 new empty files every time it runs
- File names follow the pattern
<yourname><number>(e.g.,Ahmad1,Ahmad2, …) - Numbering continues from where it left off — running twice creates files 1–25, then 26–50, etc.
Key Concepts Used
Counting Existing Files
counter=$(ls <yourname>* 2>/dev/null | wc -l)
# wc -l = counts lines (= number of files)
# 2>/dev/null = suppresses "no such file" error messages
For Loop Approach
name="Ahmad"
for i in {1..25}; do
touch "${name}${i}"
done
While Loop Approach
name="Ahmad"
counter=$(ls ${name}* 2>/dev/null | wc -l)
last_count=$((counter + 25))
while [ $counter -lt $last_count ]; do
counter=$((counter + 1))
touch "${name}${counter}"
done
Important Syntax Notes
| Syntax | Use |
|---|---|
$(command) | Command substitution — run a command and capture output |
$((expression)) | Arithmetic operation (e.g., $((counter + 1))) |
-lt | Less than (use -le for less than or equal) |
touch filename | Create an empty file |
chmod +x script.sh | Give execute permission to a script |
2>/dev/null | Redirect error output to null (suppress errors) |
Running the Script
chmod +x create_files.sh # give execute permission
./create_files.sh # run the script
ls -v # list files in natural sort order
Tips & Lessons
- Always review AI-generated code before running it, especially for system admin tasks — AI can suggest destructive operations (e.g., dropping a database).
- Test edge cases: what happens if you delete some files mid-sequence?
- For more practice: try CMD Challenge or LeetCode's bash challenges.
3. Introduction to Networking
What Is the Internet?
- Internet = interconnected network of networks
- Brief history:
- 1960s — Packet switching theory developed
- 1970s — TCP (Transmission Control Protocol) developed
- 1980s — Dial-up introduced; email becomes possible
- 1990s — WWW (World Wide Web) introduced — beginning of websites
- 2000s+ — Explosion of devices and internet adoption
Core Networking Concepts
| Term | Meaning |
|---|---|
| Node | Any device on a network (computer, phone, server) |
| Client | Device that requests data (e.g., your laptop) |
| Server | Device that serves/responds with data (e.g., AWS EC2) |
| LAN | Local Area Network — devices connected in a small area |
| Switch | Device that connects multiple computers within a LAN |
| Router | Device that connects different networks and routes data between them |
Physical Infrastructure
- Computers on the same LAN communicate via a switch (often built into your router).
- Data travels between continents via submarine cables — thin glass fibres carrying light signals.
- Optical fibre transmits data as light (different frequencies/colours).
- Alternatives: satellite (e.g., Tesla Starlink) uses satellite links instead of cables.
- Data for computers is ultimately just 0s and 1s transmitted as light or electrical signals.
Simple Network Diagram
[Computer A] ─┐
[Computer B] ─┤── [Switch] ── [Router] ── Internet
[Computer C] ─┘
MAC Address
- Every network device has a MAC (Media Access Control) address — a unique hardware identifier.
- Used to identify devices within a local network.
4. OSI Model
What Is the OSI Model?
The OSI (Open Systems Interconnection) model is a conceptual framework that standardises how data is sent across a network. It has 7 layers.
📬 Analogy — Sending a Letter: You write a letter (application), choose a language (presentation), drop it at the post office (session), the postal service routes it (transport/network), a courier carries it (data link/physical). Your recipient reverses the process to read it.
The 7 Layers
| Layer | Name | Key Responsibility | Data Unit | Example |
|---|---|---|---|---|
| 7 | Application | User-facing apps | Data | HTTP, HTTPS, email (Gmail) |
| 6 | Presentation | Encryption/decryption, formatting | Data | SSL/TLS encryption |
| 5 | Session | Manages sessions between apps | Data | Keeps Zoom & Chrome traffic separate |
| 4 | Transport | Logical connection between devices | Segment | TCP, UDP |
| 3 | Network | Path selection (routing) | Packet | IP address, routing |
| 2 | Data Link | Data framing, MAC addresses | Frame | Ethernet, MAC |
| 1 | Physical | Actual transmission (light/electrical) | Bits | Optical fibre, cables |
Most Important Layers to Know
- Layer 7 (Application) — HTTP/HTTPS lives here.
HTTPS= HTTP + TLS encryption (the "S" = Secure). - Layer 4 (Transport) — TCP establishes logical connections between two devices.
- Layer 3 (Network) — Handles routing and IP addresses; decides the path data takes.
- Layer 2 (Data Link) — Uses MAC addresses to identify devices on a local network.
How Data Is Broken Down
When you send a large file or email, it is not sent as one chunk:
- Data is split into packets (Layer 3)
- Packets travel independently across the network
- Packets are reassembled in the correct order at the destination
Each packet contains: packet number, protocol, encryption type, bit order (endianness), and flags.
💡 Next class will continue with more OSI model detail and networking components (switches, routers in depth).
CLF-C02 Exam Relevance Summary
The AWS Certified Cloud Practitioner (CLF-C02) exam tests foundational cloud and IT knowledge. Here is how today's topics map to exam domains:
| Topic Covered | CLF-C02 Domain | Relevance |
|---|---|---|
| Logs & monitoring (CloudWatch Logs equivalent) | Domain 2: Security & Compliance / Domain 4: Billing | AWS CloudWatch collects and monitors logs from EC2 and other services — same concepts apply |
Linux log files (/var/log/) | Domain 3: Cloud Technology | EC2 instances (especially Amazon Linux) store logs here; foundational for understanding cloud compute |
| Authentication logs & security auditing | Domain 2: Security & Compliance | AWS CloudTrail records API calls; IAM audit logs — same principle as /var/log/secure |
| Package managers (yum/apt) | Domain 3: Cloud Technology | Amazon Linux uses yum; knowing this is relevant for EC2 administration |
| OSI Model — Layers 3, 4, 7 | Domain 3: Cloud Technology | Understanding networking layers is essential for AWS VPC, Security Groups, Load Balancers, and Route 53 |
| MAC addresses & LAN/Switch/Router | Domain 3: Cloud Technology | Background knowledge for VPC networking, subnets, and routing tables |
| HTTP vs HTTPS (Layer 7) | Domain 2: Security & Compliance | CLF-C02 tests knowledge of secure communication; HTTPS/TLS is directly relevant |
| Client–Server model | Domain 3: Cloud Technology | Core concept behind EC2 (server) and end-users (clients); foundational for cloud architecture |
✅ Key CLF-C02 AWS Services to connect these concepts to:
- Amazon CloudWatch — log collection, monitoring, and alerting (maps to log management)
- AWS CloudTrail — API and user activity auditing (maps to security/auth logs)
- Amazon VPC — virtual networking (maps to OSI model, routing, subnets)
- AWS IAM — identity and access management (maps to authentication logging)
- Amazon EC2 — Linux instances where all these log concepts apply directly
Notes compiled from April 21, 2026 lecture. Next session: OSI Model deep-dive + Networking Components.