Project — Python Log Analysis Tool¶
Beginner portfolio build for Python for DevOps — turn the log analyser lab into a packaged, tested CLI.
Project Overview¶
Goal: Ship an installable console script that analyses application logs and writes a summary report.
Deliverable for your portfolio:
- Packaged CLI (
loganalyseor similar) viapyproject.toml pathlib+ regex aggregation- JSON (and optional text) output
pytestfor parsers and exit codes- README with sample logs and usage
Estimated cost: £0.
Goals¶
- Console script entry point
-
--input/--output/--min-levelflags - Stable JSON schema documented in README
- Unit tests for regex and aggregation
- Clear exit codes (
0ok,2usage/input)
Stack¶
| Piece | Choice |
|---|---|
| Packaging | pyproject.toml |
| CLI | argparse or Typer |
| Test | pytest |
Prerequisites¶
- Labs: Python Log Analyser
- Tutorials: Python Fundamentals, File Handling, Testing with pytest
Milestones¶
Milestone 1 — Lab → package¶
Move lab script into src/loganalyse/, add pyproject.toml with [project.scripts].
Milestone 2 — CLI polish¶
Help text, validation, stderr errors, --format json|text.
Milestone 3 — Tests and sample data¶
tests/fixtures/*.log, pytest coverage of counts and missing-input exit code.
Milestone 4 — README¶
Architecture note, example invocation, link to next intermediate project.
Success criteria¶
pip install -e .thenloganalyse --helpworks- Tests pass offline
- Sample run matches documented expected JSON
Related¶
- Lab: Python Log Analyser
- Next: Infrastructure Inventory CLI
- Cheat sheet: Python