Implement comprehensive security audit logging for compliance, forensics, and SIEM integration. Use when building audit trails, compliance logging, or security monitoring systems.
Implement comprehensive audit logging for security events, user actions, and system changes with structured logging, retention policies, and SIEM integration.
Minimal working example:
// 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)
Detailed implementations in the references/ directory:
| Guide | Contents | |---|---| | Node.js Audit Logger | Node.js Audit Logger | | Python Audit Logging System | Python Audit Logging System | | Java Audit Logging | Java Audit Logging |
Copy a source-pinned command for your client. You run it yourself.
Destination: .claude/skills/security-audit-logging · pinned to the source commit
# Run from your project root
git clone https://github.com/aj-geddes/useful-ai-prompts.git .skillboard-tmp
git -C .skillboard-tmp checkout 3f5182cfd739fc113f4af5244a1cf342ad7f7911
mkdir -p ".claude/skills"
cp -r ".skillboard-tmp/skills/security-audit-logging" ".claude/skills/"
rm -rf .skillboard-tmpReview the source before running. This copies files into your project; it is not a one-click install and does not verify runtime safety.
sudo apt update && sudo apt install -y gitnpm install -g @anthropic-ai/claude-code# Run from your project root
git clone https://github.com/aj-geddes/useful-ai-prompts.git .skillboard-tmp
git -C .skillboard-tmp checkout 3f5182cfd739fc113f4af5244a1cf342ad7f7911
mkdir -p ".claude/skills"
cp -r ".skillboard-tmp/skills/security-audit-logging" ".claude/skills/"
rm -rf .skillboard-tmpDestination: .claude/skills/security-audit-logging
Scanner static-checks@0.1.0 · commit 3f5182cfd739. Static checks cannot prove runtime safety – review the source and the exact diff before installing. How checks work.
References credentials, tokens or secret files that a skill should not need.
Evidence: [redacted]· fingerprint 5e884898da280471