Skip to main content
skill CX Codex

security-audit-logging — Claude Code skill: audit logs and SIEM

A skill that walks your agent through building security audit logging: events, user actions, system changes. Useful when you need logs for compliance or incident review.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add aj-geddes/useful-ai-prompts --skill security-audit-logging -a claude-code
Open on GitHub

What security-audit-logging does

The skill hands the agent a plan for audit logging: structured records, retention policies, shipping to a SIEM. It ships a short JavaScript example built on winston with an Elasticsearch transport, plus deeper implementations in the references/ directory for Node.js, Python and Java.

People reach for it when logs have to satisfy compliance work (SOC 2, HIPAA, PCI-DSS), feed security monitoring, support forensics or track user activity. The skill also sets boundaries: keep passwords and secrets out of the log, don't dump unnecessary PII, don't skip failed attempts, encrypt sensitive entries, watch log integrity.

One thing to check first: the examples depend on winston and winston-elasticsearch, so those packages have to be in the project before the code runs. If you don't run Elasticsearch, the SIEM transport needs replacing — the sample won't work as written.

What it helps with

  • build an audit trail of security events and user actions
  • set up structured log entries with UTC timestamps
  • ship logs to a SIEM through Elasticsearch
  • define retention and rotation for log files
  • meet compliance requirements for logging

Example prompts for the agent

  • Add security audit logging for sign-ins and permission changes using the security-audit-logging skill
  • Set up a structured audit log that ships to Elasticsearch
  • Review my logger for passwords and unnecessary PII in the log

How to install security-audit-logging

1Skills CLI (Vercel)

npx skills add aj-geddes/useful-ai-prompts --skill security-audit-logging -a claude-code

2Manually: put the files in place

~/.claude/skills/security-audit-logging/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/security-audit-logging/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about security-audit-logging

How do I install security-audit-logging in Claude?

Run npx skills add aj-geddes/useful-ai-prompts --skill security-audit-logging -a claude-code. The skill lands in ~/.claude/skills/security-audit-logging/SKILL.md.

What does security-audit-logging do?

It gives the agent guidance on audit logging: structured records, retention policies, SIEM delivery. It includes a JavaScript example and reference guides for Node.js, Python and Java.

What do the skill's examples need to run?

The example uses the winston and winston-elasticsearch packages, so install them in your project. Without Elasticsearch, the SIEM transport has to be swapped out.

Source text

SKILL.md · MIT
---
name: security-audit-logging
description: >
  Implement comprehensive security audit logging for compliance, forensics, and
  SIEM integration. Use when building audit trails, compliance logging, or
  security monitoring systems.
---

# Security Audit Logging

## Table of Contents

- [Overview](#overview)
- [When to Use](#when-to-use)
- [Quick Start](#quick-start)
- [Reference Guides](#reference-guides)
- [Best Practices](#best-practices)

## Overview

Implement comprehensive audit logging for security events, user actions, and system changes with structured logging, retention policies, and SIEM integration.

## When to Use

- Compliance requirements (SOC 2, HIPAA, PCI-DSS)
- Security monitoring
- Forensic investigations
- User activity tracking
- System change auditing
- Breach detection

## Quick Start

Minimal working example:

```javascript
// audit-logger.js
const winston = require("winston");
const { ElasticsearchTransport } = require("winston-elasticsearch");

class AuditLogger {
  constructor() {
    this.logger = winston.createLogger({
      level: "info",
      format: winston.format.combine(
        winston.format.timestamp(),
        winston.format.json(),
      ),
      transports: [
        // File transport
        new winston.transports.File({
          filename: "logs/audit.log",
          maxsize: 10485760, // 10MB
          maxFiles: 30,
          tailable: true,
        }),

        // Elasticsearch transport for SIEM
        new ElasticsearchTransport({
          level: "info",
          clientOpts: {
// ... (see reference guides for full implementation)
```

## Reference Guides

Detailed implementations in the `references/` directory:

| Guide | Contents |
|---|---|
| [Node.js Audit Logger](references/nodejs-audit-logger.md) | Node.js Audit Logger |
| [Python Audit Logging System](references/python-audit-logging-system.md) | Python Audit Logging System |
| [Java Audit Logging](references/java-audit-logging.md) | Java Audit Logging |

## Best Practices

### ✅ DO

- Log all security events
- Use structured logging
- Include timestamps (UTC)
- Log user context
- Implement log retention
- Encrypt sensitive logs
- Monitor log integrity
- Send to SIEM
- Include request IDs

### ❌ DON'T

- Log passwords/secrets
- Log sensitive PII unnecessarily
- Skip failed attempts
- Allow log tampering
- Store logs insecurely
- Ignore log analysis

© aj-geddes · MIT · aj-geddes/useful-ai-prompts

Similar skills

Everything for Security →

From the same set118

accessibility-testing A skill that walks your agent through WCAG checks: axe scans, keyboard navigation, ARIA, screen readers. Useful when a project has to meet a11y requirements. CX Codex +1 575installs push-notification-setup Integrates push notifications for iOS and Android using Firebase Cloud Messaging and APNs. Helps handle token refreshes, deep linking, and background sync. CX Codex +1 575installs database-schema-documentation Documents database schemas, generates Mermaid ERD diagrams, and tracks table constraints. Useful when creating data dictionaries or writing migration specs. CX Codex +1 569installs Data Visualization A skill that steers your agent toward the right chart type and gives working matplotlib and seaborn code for analysis and stakeholder decks. CX Codex +1 568installs mobile-app-debugging A skill for tracking down failures that only show up on a device: crashes, slow frames, flaky connectivity. CX Codex +1 561installs process-mapping A skill that walks the agent through documenting a current workflow, spotting bottlenecks and designing an improved version. CX Codex +1 552installs memory-optimization A skill for profiling application memory, finding leaks and cutting the footprint. Useful when a process keeps growing or dies with out of memory. CX Codex +1 544installs web-performance-audit This skill measures page load times, finds bottlenecks and points at what to fix. Useful after a big release or when users complain about slowness. CX Codex +1 543installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor