Audit Trail

Implement structured audit trail logging with FastAPI middleware and PostgreSQL storage.

1|Updated Sep 14, 2025
One-click install
npx skills add https://github.com/CleanExpo/DR-NRPG --skill audit-trail-cleanexpo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Audit Trail
Source: https://github.com/CleanExpo/DR-NRPG/tree/main/.skills/custom/audit-trail
Command: npx skills add https://github.com/CleanExpo/DR-NRPG --skill audit-trail-cleanexpo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a robust framework for logging all significant actions within the application, ensuring a complete and immutable record for security audits, forensic analysis, and compliance reporting.

Core Features & Use Cases

  • Immutable Logging: Ensures audit records cannot be altered or deleted after creation.
  • Comprehensive Capture: Logs state-changing operations, authentication events, and agent activities.
  • Correlation: Links events to specific users, requests, and agent runs via correlation IDs.
  • Retention Policies: Manages data lifecycle with configurable retention periods for different event types.
  • Query API: Provides a secure endpoint for authorized users to retrieve audit data.
  • Use Case: When a user updates a sensitive document, this Skill automatically records who made the change, when, from what IP address, and the outcome, creating an auditable trail.

Quick Start

Implement the Audit Trail skill by adding the AuditMiddleware to your FastAPI application.

Frequently Asked Questions about Audit Trail

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement immutable audit trail logging in a FastAPI application?

Audit trail logging captures state-changing operations, authentication events, and agent activities. It links events to specific users, requests, and agent runs via correlation IDs, creating a complete record for security audits and forensic analysis.

How do I ensure completeness and correlation of security logging events?

Audit trail retention policies manage the data lifecycle with configurable retention periods for different event types. This allows you to manage how long specific audit records are stored in PostgreSQL for compliance and forensic requirements.

Can I use PostgreSQL to store and query security logging data for compliance?

Audit trail logging is needed when you must track who made changes to sensitive documents, when, from what IP address, and the outcome. It is essential for maintaining an auditable trail for compliance reporting and forensic analysis.

Does FastAPI middleware support structured audit trail logging for NodeJS-Starter-V1?

To retrieve audit trail data, use the provided secure Query API endpoint. This endpoint allows authorized users to retrieve audit data captured by the FastAPI middleware and stored in PostgreSQL.