Back to skills
SKILL.md
1916 Audit Log B740c581
ASecurityImplement database audit logging
- 9 stars
- 0 votes
- 0 copies
- 0 views
- Added October 11, 2026
Security analysis
100/100npx -y skills add tools-only/X-Skills --skill 1916-audit-log_b740c581 --agent claude-codeAre you the author of 1916 Audit Log B740c581?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/tools-only-1916-audit-log-b740c581)---
description: Implement database audit logging
---
# Database Audit Logger
Track database changes for compliance and debugging.
## Audit Strategies
1. **Trigger-Based**: Database triggers on INSERT/UPDATE/DELETE
2. **Application-Level**: Log in application code
3. **CDC (Change Data Capture)**: Stream changes
4. **Database Logs**: Parse database transaction logs
## Audit Table Template
```sql
CREATE TABLE audit_log (
id SERIAL PRIMARY KEY,
table_name VARCHAR(100) NOT NULL,
operation VARCHAR(10) NOT NULL,
old_data JSONB,
new_data JSONB,
user_id INTEGER,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Trigger example
CREATE OR REPLACE FUNCTION audit_trigger()
RETURNS TRIGGER AS $$
BEGIN
INSERT INTO audit_log (table_name, operation, old_data, new_data)
VALUES (TG_TABLE_NAME, TG_OP, row_to_json(OLD), row_to_json(NEW));
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
```
## When Invoked
Generate audit logging implementation for compliance tracking.
Attribution
Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.