Skip to content
Tutorials Center
My learning

Topics

Lesson 36 of 37 ยท Projects and Practice

Project: An Incident Report Generator

Turn structured incident data into a clear report: validate fields, compute durations, build the timeline and render a Markdown summary for managers and technical readers.

Handling an incident is half the job. The other half is explaining it: to managers who need impact and decisions, to engineers who need technical detail, and to auditors who need evidence. A good report is short, accurate and consistent. In this project you build a small tool that turns structured incident data into a Markdown report, so that every report has the same sections and the same computed numbers. The incident is invented.

Why structure the data first

If analysts write reports freehand at the end, details get lost and every report looks different. Instead, record data as the incident unfolds (timestamps, actions, indicators, affected assets) and generate the report from it. The same data can also feed metrics and the post-incident review.

flowchart LR
    A["Case data: fields, timeline, indicators"] --> B["Validate"]
    B --> C["Compute durations and counts"]
    C --> D["Render Markdown report"]
    D --> E["Review and publish"]

Data in, validation, computation, rendering. The tool does not write the analysis for you: analysts still own the conclusions.

Step 1: the data model and validation

Define what a complete incident record contains and reject incomplete ones. Missing fields are far easier to fix during the incident than three weeks later.

Python Step 1: incident record with validation

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Step 2: compute the numbers

Durations are computed, not typed, so they are always consistent with the timestamps.

Python Step 2: durations and counts

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Step 3: render the report

Rendering is string formatting. Keep the layout stable so readers know where to look: a summary for managers first, then the technical detail.

Python Step 3: render a Markdown report

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Writing quality: what good reports share

  • Lead with the answer: what happened, how bad, is it over, what do you need from the reader.
  • Facts versus judgment: label what logs show and what you infer.
  • Plain words in the summary; technical terms in the details.
  • Time zone on every timestamp (UTC), and a clear sequence.
  • No blame; focus on systems and processes.
  • Sensitive data handled carefully: redact personal data and secrets, and mark the distribution list (for example with a TLP label from threat intelligence handling).
  • Actions with owners and dates, linked to the follow-up tracker (post-incident review).

Write two audiences into one report: a half-page summary that a manager can read in two minutes, and an appendix with the evidence that an engineer or auditor can check.

Extend the project

  1. Add an executive summary generator that picks one of several sentence templates based on severity and impact.
  2. Add a check that warns when the timeline has gaps of more than an hour during the incident.
  3. Export the same data as JSON, and compute monthly averages over several incidents (metrics).
  4. Add a section listing the evidence items and their hashes (evidence handling).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Why compute durations from timestamps instead of typing them in?

    A single source of truth prevents contradictory numbers in a report.
  2. 2. What should the first section of an incident report contain?

    Readers should get the main answer in the first lines; detail comes after.
  3. 3. Why validate the record before generating the report?

    Early validation catches gaps such as missing times, severity or root cause.
  4. 4. How should facts and conclusions be handled in a report?

    Readers need to know what is proven by logs and what is analyst judgment.

Summary

  • Capture incident data in a structure, validate it, compute durations, then render the report.
  • Keep a stable layout: summary first, details and evidence after.
  • Separate facts from inference, use UTC, avoid blame and protect sensitive data.
  • Link actions to owners and dates, and reuse the data for metrics.

Next: Practice: SOC Analyst Scenarios