π Day 15 β Building a Proper Terminal Logging Pipeline
π― Goal
Create a reliable, professional-grade terminal logging system that:
-
Records everything I do during a lab
-
Preserves raw data for forensic accuracy
-
Produces a clean, readable Markdown log suitable for Obsidian and GitHub Pages
-
Requires zero manual editing after the session ends
This is about moving from βmessy learningβ to reproducible, auditable lab work.
π§ What I Built
By the end of the day, I designed and debugged a two-layer logging pipeline:
1οΈβ£ Raw Log (Source of Truth)
-
Captured using
script -
Stored as
session.raw.log -
Contains:
-
Full terminal output
-
ANSI escape codes
-
Redraw artifacts
-
Prompts, usernames, hostnames
-
This file is never edited. It is the equivalent of a pcap: immutable evidence.
2οΈβ£ Clean Log (Human-Readable)
Automatically generated as session.clean.md, with:
-
Commands rendered in bold
-
Command output rendered in italic
-
No ANSI junk
-
No usernames or hostnames
-
Chronological, faithful reconstruction of the session
This file is what I actually read, study, and publish.
π οΈ Core Features Implemented
-
startlog <lab_name>-
Creates a timestamped lab folder
-
Starts a subshell that is fully recorded
-
-
stoplog-
Ends the recording cleanly
-
Automatically runs the cleaner
-
Produces the final Markdown file
-
-
Automatic handling of:
-
ANSI escape sequences (CSI, OSC)
-
Backspaces and redraws
-
Carriage returns
-
No manual cleanup. No copy/paste. No rewriting history.
π₯ Key Breakthroughs
-
Fixed greedy regex that was silently eating command output
-
Learned how terminal control sequences actually behave
-
Understood why raw logs must stay raw
-
Built a pipeline that mirrors real-world SOC / red-team workflows
This wasnβt about Bash syntax β it was about thinking like an analyst.
π Final Structure
lab_logs/
βββ 2026-02-06_201944_fix_test/
βββ session.raw.log # full, untouched transcript
βββ session.clean.md # blog-ready Markdown
β Outcome
I now have a repeatable, professional lab logging system that:
-
Scales with complexity
-
Preserves evidence
-
Produces publishable material automatically
This is a foundational tool Iβll reuse for every future Linux, privilege escalation, and red-team lab.
Day 15 was about building the tooling, not just learning commands β and thatβs a major shift.
π§ Next step: use this pipeline for real SUID / permission labs without touching it again.
