Skip to content
OnlyProjects
MCA · Cyber SecurityFor educational purposes only
Code included

Privacy-Preserving Log Anonymisation Pipeline for a College Web Server (Python/MySQL)

Keep the 180-day CERT-In log trail without keeping your students' personal data inside it

Mapped to your syllabusAnna University MCA Regulation 2021 · Project Work · Semester 4

Overview

1 min read

PrivLog: a Privacy-Preserving Log Anonymisation Pipeline sits between a college web server and its log archive, and solves a problem every Indian campus now has: the logs the law requires you to keep are the same logs that hold your students' personal data.

Since CERT-In's Directions of 28 April 2022, organisations must retain computer logs for a rolling 180 days (and report incidents within six hours). Since the Digital Personal Data Protection Act, 2023, students are data principals whose roll numbers, email addresses and device identifiers in those logs deserve minimisation and protection. Most college servers simply keep raw logs — IP addresses, /results/<roll-number> URLs, email addresses in query strings — on a badly protected folder.

This project builds the missing layer: a Python pipeline that tails the web server's access log, detects identifiers (IPv4 addresses, emails, phone numbers, the college's roll-number pattern, high-cardinality user agents), and transforms them — keyed HMAC-SHA256 pseudonyms with the key held outside the database, IP-address truncation, user-agent generalisation — before anything is stored long-term. A verification gate re-scans the output for leaked identifiers and enforces a k-anonymity threshold on analyst exports. A Flask dashboard shows before/after utility metrics, proving the anonymised logs still answer operational questions (top pages, hourly load, error rates) while carrying no direct identifiers.

Python and MySQL come straight from the Anna University R2021 MCA curriculum (MC4103, MC4202); Flask and Chart.js are clearly-labelled industry-standard extras. Two students can complete it in one semester, with clean per-member module boundaries.

Relevant for
Tamil Nadu
Level
Intermediate · 14 weeks · team of 2
Common at
Anna University, Bharathiar University, Osmania University
Updated
Nov 2026

Syllabus alignment

Anna University · MCA Regulation 2021

Project Work · Semester 4

Subjects this project applies
  • Python (MC4103)
  • Cyber Security (professional elective)
  • Advanced DB (MC4202)
  • DevOps (MC4009)
  • Data Viz (MC4019)
How it is evaluated

See your department's project guidelines.

Also fits: Bharathiar University 2023-24, Osmania University 2-year MCA 2022-23.

What's in the box

11 parts · 5 free · 2 previewed · 4 unlock for ₹2,000

Problem & synopsis

6 min read

Problem statement

Indian colleges must keep web-server logs for 180 days under CERT-In's Directions of April 2022, yet the same logs embed students' personal data — device IP addresses, user agents precise enough to fingerprint a device, and roll numbers or email addresses embedded in URLs. Retained raw, the log archive becomes the single most sensitive file on campus: an unencrypted, months-long record of which student accessed which result or fee page, from where and when. The Digital Personal Data Protection Act, 2023 makes such casual retention of identifiable data hard to justify, while deleting logs early would break incident response and CERT-In's six-hour reporting expectation.

There is no tooling in a typical college for this: no inventory of what identifiers the logs contain, no separation between the audit purpose (incident investigation) and the analyst purpose (student projects, capacity planning), and no measurable guarantee that shared datasets are actually de-identified. What is needed is a pipeline that anonymises at ingestion time, retains the operational value of the log trail, proves the transformation with automated verification, and gives the college two defensible profiles — audit-grade and analyst-grade — for its two distinct purposes.

Synopsis

Abstract

A college web server's access log is simultaneously a security record and a personal-data liability. CERT-In's Directions of 28 April 2022 require a rolling 180-day log retention, while the Digital Personal Data Protection Act, 2023 imposes purpose-limitation and storage-minimisation duties on anyone processing students' personal data. This project builds a pipeline that keeps the operational and forensic value of web-server logs while stripping the personal data out: it detects direct and quasi-identifiers, transforms them (keyed pseudonyms, truncation, generalisation), verifies the output with a leakage scan and a k-anonymity gate, and stores only anonymised events in MySQL, with a dashboard measuring surviving analytical utility.

Introduction

A typical affiliated-college results portal serves thousands of requests a day. Every request line records the device's IP address, a fingerprintable user-agent string, and URLs embedding roll numbers (/results/2021cs1042.pdf) or occasional email addresses. Retained raw for 180 days, it is an unencrypted dossier of who checked which result, from where and when. The college cannot stop logging — incident response depends on it — so the data must be transformed before storage.

Existing System

  • Raw logs are rotated and kept on the server for months, readable by anyone with the account.
  • No inventory of what the logs contain — roll numbers, emails, device identifiers.
  • Project students asking for logs get a raw copy emailed.
  • Deletion policies swing between "keep everything forever" and "delete after a week", neither compliant.
  • Limitations: no identifier inventory, no separation of audit needs from analyst needs, no measurable privacy or utility guarantee.

Proposed System

  • Ingest: tail the access log, parse Common Log Format lines into structured events in a short-lived staging table.
  • Classify: pluggable detectors find IPv4 addresses, emails, phone numbers, the college's roll-number pattern and user-agent strings, recording type, position and count per run.
  • Transform: keyed HMAC-SHA256 pseudonyms (key in a separate keystore file) for roll numbers and IPs; last-octet truncation; user agents generalised to browser-and-OS family; free-text identifiers redacted.
  • Verify: a leakage gate re-runs every detector on the output and blocks the batch if anything survives; analyst exports additionally pass a k-anonymity check (k ≥ 5).
  • Store and serve: only anonymised events land in MySQL; a Flask dashboard shows per-run findings and before/after utility metrics.
  • Configure: two profiles — audit-grade (reversible only with the keystore) and analyst-grade (one-way, generalised, k-checked) — matching the two lawful purposes.

Feasibility Study

  • Technical: Python 3, MySQL 8 and Flask are free and run on the college's existing server; the pipeline is a batch job needing no web-server changes.
  • Economic: zero licence cost; the only new artefact is the permission-protected keystore file.
  • Operational: the IT section keeps its 180-day trail anonymised, project students get safe datasets, and the dashboard replaces manual grepping.
  • Ethical and legal: the bundle's development dataset is fully synthetic; real logs are processed only on the college's own server with written permission, and raw events are purged after the utility comparison.

Objectives

  1. 01Build an ingestion and parsing stage for the college web server's Common Log Format files, targeting at least 99 percent parse success on real traffic samples.
  2. 02Implement pluggable detectors for direct and quasi-identifiers — IPv4 addresses, email addresses, phone numbers, the college's roll-number pattern and high-cardinality user agents — recording type, position and count for every match.
  3. 03Implement keyed HMAC-SHA256 pseudonymisation with the pepper held in a separate keystore file outside the database, together with last-octet IP truncation and browser-family user-agent generalisation.
  4. 04Provide an automated verification gate that re-scans anonymised output with all detectors and rejects any batch in which an identifier survives.
  5. 05Enforce a k-anonymity check (k ≥ 5) on every analyst-grade export so released datasets cannot single out individual students.
  6. 06Store anonymised events in MySQL and prove utility retention by recomputing top-page, hourly-volume and error-rate reports on anonymised data against a raw baseline, targeting at least 95 percent agreement on aggregate reports.
  7. 07Deliver a Flask dashboard showing per-run findings, before/after utility charts and the two anonymisation profiles, with CSV export for downstream users.

Scope

In scope

  • The college's own web server access log (Common Log Format / combined format) as the single source; file-based ingestion only.
  • Detector and transformer coverage for IP addresses, emails, phone numbers, one configurable roll-number pattern and user agents.
  • Two anonymisation profiles (audit-grade, analyst-grade) with the keystore file kept separately from the database.
  • Verification gate (leakage scan and k-anonymity check), utility measurement, dashboard and CSV export.
  • A synthetic log generator so the whole pipeline can be demonstrated without touching real student data.

Out of scope (v1)

  • Network-level capture or DNS/proxy logs; only the web server's file log is processed.
  • Re-identification attacks against other people's datasets — the study measures risk on our own outputs only.
  • Formal differential-privacy noise; k-anonymity and generalisation are the v1 guarantees.
  • Real-time streaming processing; the pipeline runs on rotation intervals (five-minute batch).

Methodology

The project follows an incremental SDLC model with fortnightly increments, so a working pipeline exists from week 3 and each review adds capability. Both members develop against the same MySQL schema from week 2.

PhaseWeeksActivitiesDeliverable
Requirement & data study1–2Sample the college server's log formats, inventory identifier types with the IT section, finalise the two profiles and the roll-number patternSRS + identifier inventory
Design2–3Schema design, ER and DFD diagrams, detector interface, transformation spec, dashboard wireframesDesign document
Increment 14–6Ingestion, parsing, staging table, synthetic log generator (Member 1); detector framework with first detectors (Member 2)Raw-to-staging pipeline with findings recorded
Increment 27–9Transformation engine: HMAC pseudonyms, IP truncation, UA generalisation; verification gate with leakage scanFirst anonymised batches passing the gate
Increment 310–11k-anonymity export check, utility metrics recomputation and baseline comparison, dashboardEnd-to-end system with before/after charts
Testing & tuning12Property tests, utility regression, performance run on one million linesTest report
Documentation & viva prep13–14Consolidated report, PPT, demo rehearsalFinal submission

Testing approach: pytest unit tests per detector and transformer; a property-based test asserting that no detector ever matches on pipeline output, whatever the input; a utility regression comparing aggregate reports before and after anonymisation on the same synthetic day; and a performance run confirming one million log lines process in under ten minutes on the college's existing server.

Architecture & tech stack

2 diagrams · 5 technologies · 2 min read

  • Python 3
  • MySQL 8
  • Flask
  • JavaScript (ES6)
  • Chart.js

PrivLog is a batch pipeline with a hard verification gate, deliberately placed so that raw events never reach long-term storage:

  1. Ingestion — a tailer follows the access log on the college's own server and hands raw lines to the parser in batches.
  2. Parsing & staging — Common Log Format lines are parsed into structured events and landed in a staging table that is purged after each run's utility comparison.
  3. Classification — the detector framework scans every field; each match is recorded in a findings table (type, position, sample-hashed value) so the report can show exactly what the logs contained.
  4. Transformation — keyed HMAC-SHA256 pseudonyms for roll numbers and IPs (key loaded from the keystore file, never stored in MySQL), last-octet truncation, user-agent generalisation to browser-and-OS family, redaction for emails and phones.
  5. Verification gate — the leakage scan re-runs all detectors on transformed output; the k-anonymity check applies to analyst-grade exports; a failed check blocks the batch and raises a run error.
  6. Storage & presentation — anonymised events land in MySQL; a Flask dashboard shows findings, before/after utility charts and run history; exports are CSV.
flowchart LR
  L["access.log on college web server"] --> T[Tailer]
  T --> P[Parser and stager]
  P --> S[(Staging table - purged per run)]
  S --> D[Detector framework]
  D --> F[(Findings)]
  D --> X[Transformation engine]
  K[("Keystore file (HMAC key)")] --> X
  X --> G{Verification gate}
  G -->|identifier found| B[Block batch and raise error]
  G -->|clean| A[(MySQL - anonymised events)]
  A --> U[Utility metrics]
  U --> DB2[(Dashboard - Flask)]
  A --> E["Analyst export (k-anonymity checked)"]

ER diagram (core tables)

erDiagram
  PIPELINE_RUN ||--o{ EVENT : produces
  PIPELINE_RUN ||--o{ FINDING : records
  PIPELINE_RUN ||--o{ METRIC : computes
  CONFIG_PROFILE ||--o{ PIPELINE_RUN : "configures"
  EVENT ||--o{ EXPORT_ROW : "feeds"
  EVENT {
    bigint id PK
    datetime ts
    string ip_prefix
    string ip_pseudonym
    string ua_family
    string path_pseudonymised
    int status
    string method
  }
  FINDING {
    bigint id PK
    bigint run_id FK
    string id_type
    string field
    int count
  }
  PIPELINE_RUN {
    bigint id PK
    datetime started_at
    string profile
    string status
    int lines_in
  }
  CONFIG_PROFILE {
    string name PK
    string pseudonym_mode
    bool k_check
    int k_value
  }
  METRIC {
    bigint id PK
    bigint run_id FK
    string metric_name
    decimal raw_value
    decimal anon_value
  }
  EXPORT_ROW {
    bigint id PK
    bigint event_id FK
    string export_id
  }

The key design decision is purpose separation: audit-grade pseudonyms are reversible only by whoever holds the keystore (for incident response), while analyst-grade data is one-way, generalised and k-checked. One pipeline, two lawful purposes, nothing shared by accident.

Modules

6 modules

  1. Module 01

    Ingestion & Parsing (Member 1)

    Tails the college web server's access.log, parses Common Log Format and combined-format lines into structured events, lands them in a short-lived staging table purged after each run, and tracks parse failures with sample lines for pattern fixes.

  2. Module 02

    Identifier Classifier (Member 1)

    A pluggable detector framework — IPv4, email, phone, the college's configurable roll-number pattern, user agents — that scans every field, records type, position and count per run in a findings table, and exposes an interface so the college can add patterns like fee-receipt numbers.

  3. Module 03

    Transformation Engine (Member 2)

    Applies profile-driven transforms: keyed HMAC-SHA256 pseudonyms for roll numbers and IP addresses with the key loaded from a separate keystore file, last-octet IP truncation in analyst mode, user-agent generalisation to browser-and-OS family, and redaction for free-text identifiers.

  4. Module 04

    Verification Gate (Member 2)

    Re-runs every detector over the transformed batch and blocks it if any identifier survives; applies the k-anonymity check (k at least 5) to analyst-grade exports; raises a run error with the offending sample so the detector or transformer can be fixed before the next run.

  5. Module 05

    Storage & Utility Metrics (Member 1)

    The MySQL schema for anonymised events, runs, findings and metrics; recomputes top-page, hourly-volume and error-rate reports on anonymised data and compares them with the raw baseline from staging, producing the utility-retention percentages for the report.

  6. Module 06

    Dashboard & Reports (Member 2)

    A Flask and Chart.js dashboard showing run history, findings by identifier type, before/after utility charts, profile configuration and CSV export; includes the synthetic-log generator controls so the demo can run without touching real student data.

Slides

12 slides · titles free · bullets, notes and the .pptx unlock

  1. Slide 1

    PrivLog — Privacy-Preserving Log Anonymisation Pipeline

  2. Slide 2

    Two Laws, One Log File

  3. Slide 3

    Problem Statement

  4. Slide 4

    Proposed System

  5. Slide 5

    Objectives

  6. Slide 6

    Technology Stack

  7. Slide 7

    System Architecture

  8. Slide 8

    Database Design

  9. Slide 9

    Member-wise Modules

  10. Slide 10

    Demo — Synthetic Day Through the Pipeline

  11. Slide 11

    Testing & Results

  12. Slide 12

    Conclusion & Future Scope

Bullets, speaker notes and the .pptx · ₹2,000

The titles above are the real outline. The rest is what you present from.

Unlock for ₹2,000

Viva questions & answers

3 of 14 answered free · 11 unlock

Read each answer, close it, and say it in your own words. Your viva will ask. Now you'll know.

  1. 01Concept

    Which published papers or standards is this project actually based on?

    NIST SP 800-122 for PII identification and minimisation practice, RFC 6973 for the correlation and profiling risks of identifiers, the Sweeney 2002 paper for k-anonymity, RFC 2104 for HMAC, and CERT-In's 2022 Directions plus the DPDP Act 2023 for the Indian compliance framing. Each is cited in the literature chapter with what we took from it.

  2. 02Concept

    What is the difference between anonymisation and pseudonymisation, and which did you use?

    Pseudonymisation replaces identifiers with tokens but allows reversal by whoever holds the key; anonymisation aims to remove identifiability irreversibly. We use both, deliberately: audit-grade output is pseudonymised (reversible with the keystore for incident response), while analyst-grade output is one-way, generalised and k-checked, approaching true anonymisation for released datasets.

  3. 03Concept

    Explain k-anonymity and why you chose k = 5.

    A dataset is k-anonymous when every combination of quasi-identifiers appears at least k times, so no individual is unique. We chose k = 5 as a defensible small-cohort threshold — with synthetic classes of dozens of students it keeps groups meaningful without making exports useless — and the value is a single config field, so the college can raise it.

+11 more questions, with answers

Try the free ones out loud first. Your examiner will not accept “it's in the PPT”.

Source code & how to run

7 steps · complete source code · unlocks with the project

Unlocks with the project · ₹2,000

7 steps · source code zip

Prerequisites, install, seed data and tests, written for demo day. Plus the complete source.

Unlock for ₹2,000

READMEFIRST

257 words · unlocks with the project

What to change before it goes anywhere near a submission. Skipping it is how the demo fails live.

Unlocks with the project · ₹2,000

257 words · ~1 min read

The checklist of things to rename, re-seed and re-think so the project reads as yours.

Unlock for ₹2,000

Instructions

343 words · unlocks with the project

How to study it, adapt it and walk your examiner through it, step by step.

Unlocks with the project · ₹2,000

343 words · ~2 min read

Report structure, formatting rules and the submission checklist your department will grade.

Unlock for ₹2,000

References

10 sources

  1. Indian Computer Emergency Response Team (CERT-In) — Directions under Section 70B(6) of the Information Technology Act, 28 April 2022 (180-day rolling log retention; 6-hour incident reporting)
  2. Ministry of Electronics and Information Technology — The Digital Personal Data Protection Act, 2023
  3. NIST Special Publication 800-122 — Guide to Protecting the Confidentiality of Personally Identifiable Information (PII)
  4. RFC 6973 — Privacy Considerations for Internet Protocols (IAB)
  5. OWASP Logging Cheat Sheet
  6. MySQL 8.0 Reference Manual
  7. Python 3 — official documentation
  8. RFC 2104 — HMAC: Keyed-Hashing for Message Authentication, February 1997
  9. Latanya Sweeney, "k-Anonymity: A Model for Protecting Privacy", International Journal of Uncertainty, Fuzziness and Knowledge-Based Systems, 10(5), 2002
  10. William Stallings, Effective Cybersecurity: A Guide to Using Best Practices and Standards, Addison-Wesley

Cite this bundle

OnlyProjects. (2026). Privacy-Preserving Log Anonymisation Pipeline for a College Web Server (Python/MySQL): MCA Cyber Security project bundle [Educational resource]. https://onlyprojects.online/projects/mca-cyber-privacy-log-anonymisation-pipeline

Future scope

1 min read

  • Streaming mode with a line-by-line gate for very high-traffic servers, keeping the same detector and transformer interfaces.
  • Differential-privacy option for aggregate dashboards, complementing k-anonymity on exports.
  • Additional log sources — DNS query logs and proxy logs through the same pipeline, widening campus coverage.
  • Retention automation — scheduled 180-day purge jobs with signed deletion certificates for the college's compliance file.
  • Re-identification risk scoring — publish a quantified risk estimate (prosecutor/journalist models) alongside every analyst export.
  • A deployment guide for other departments, so the pipeline becomes shared campus infrastructure rather than a one-semester project.

Keep browsing

Same degree, same syllabus slot, different idea. Pick the one your guide will actually approve.