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.
npx skills add aj-geddes/useful-ai-prompts --skill security-audit-logging -a claude-codeWhat 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-code2Manually: put the files in place
~/.claude/skills/security-audit-logging/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/security-audit-logging/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill security-audit-logging -a codex2Manually: put the files in place
.agents/skills/security-audit-logging/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill security-audit-logging -a cursor2Manually: put the files in place
.cursor/skills/security-audit-logging/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install aj-geddes/useful-ai-prompts security-audit-logging2Manually: put the files in place
.github/skills/security-audit-logging/SKILL.md1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill security-audit-logging -a gemini-cli2Platform CLI
gemini skills install https://github.com/aj-geddes/useful-ai-prompts --path skills/security-audit-loggingManually: put the files in place
.devin/skills/security-audit-logging/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill security-audit-logging -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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