Audit logging system

From NaveedTechLab/skills-library · View interactive version

Audit logging system is an AI agent skill from the GitHub repository NaveedTechLab/skills-library. Structured JSON audit logging for all agent actions with retention and traceability guarantees. Use when Claude needs to maintain comprehensive logs of all operations, track changes, ensure compliance, or provide forensic capabilities for agent activities.

How to use this skill

Skill file

Audit Logging System

Overview

The Audit Logging System provides structured JSON audit logging for all agent actions with guaranteed retention and traceability. It ensures comprehensive logging of all operations with searchable, standardized records for compliance, forensics, and accountability.

Core Capabilities

The audit logging system provides:

  1. Structured Logging: JSON-formatted logs with standardized fields
  2. Comprehensive Coverage: Log all agent actions and operations
  3. Retention Management: Automatic log rotation and retention policies
  4. Traceability: Chain of custody and correlation between related events
  5. Search & Query: Efficient querying of historical events
  6. Compliance: Meet regulatory requirements for audit trails
  7. Security: Tamper-evident logging with integrity protection

Usage Scenarios

Use the audit logging system when:

Log Structure

Standard Log Format

All logs follow a consistent JSON structure:

{
  "timestamp": "2024-01-15T10:30:00.123Z",
  "log_level": "INFO",
  "event_type": "agent_action",
  "event_id": "uuid-v4-identifier",
  "correlation_id": "request-correlation-id",
  "trace_id": "distributed-trace-id",
  "user": {
    "id": "user-identifier",
    "role": "user-role",
    "session_id": "session-identifier"
  },
  "agent": {
    "id": "agent-identifier",
    "version": "agent-version",
    "type": "agent-type"
  },
  "action": {
    "name": "action-performed",
    "parameters": {},
    "result": "success|failure",
    "duration_ms": 1234
  },
  "resources": [
    {
      "id": "resource-identifier",
      "type": "resource-type",
      "operation": "read|write|delete|execute"
    }
  ],
  "context": {
    "source_ip": "client-ip-address",
    "user_agent": "client-identifier",
    "location": "geographic-location",
    "environment": "production|staging|development"
  },
  "metadata": {
    "version": "log-schema-version",
    "integrity_hash": "sha256-hash-of-previous-log"
  }
}

Event Types

Common event types include:

Retention Policies

Standard Retention

Log Rotation

Traceability Features

Correlation IDs

Each operation receives a correlation ID that tracks the entire operation chain:

{
  "correlation_id": "req-abc123-def456-ghi789",
  "trace_id": "trace-xyz987-wvu654-rst321"
}

Chain of Custody

Related events are linked through:

Search and Query Capabilities

Query Syntax

Structured queries using a standard syntax:

user.id:john AND action.result:failure AND timestamp:[2024-01-01 TO 2024-01-31]

Indexing Strategy

Security and Integrity

Tamper Protection

Access Controls

Compliance Standards

The system supports compliance with:

Configuration

Basic Configuration

{
  "audit_logging": {
    "enabled": true,
    "log_format": "structured_json",
    "retention_days": 2555,
    "storage_location": "/var/log/audit",
    "rotation": {
      "max_size_mb": 100,
      "compress": true,
      "keep_archives": 10
    },
    "security": {
      "integrity_protection": true,
      "encryption": "aes-256-gcm",
      "signing": true
    }
  }
}

Event Filtering

Configure which events to log:

{
  "event_filters": {
    "include": ["agent_action", "data_access", "config_change"],
    "exclude": ["heartbeat", "health_check"],
    "levels": ["INFO", "WARN", "ERROR", "CRITICAL"]
  }
}

Integration Points

With Agent Systems

The logging system integrates with:

External Systems

Integrates with:

Resources

This skill includes example resource directories that demonstrate how to implement audit logging:

scripts/

Python scripts for audit log generation, management, and querying.

references/

Documentation for log schema, compliance requirements, and integration patterns.

assets/

Configuration templates and example implementations for various audit scenarios.


The audit logging system enables comprehensive tracking and accountability for all agent actions with guaranteed retention and traceability.

When NOT to Use This Skill

Common Mistakes

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.