Initial commit
This commit is contained in:
15
.claude-plugin/plugin.json
Normal file
15
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "database-audit-logger",
|
||||
"description": "Database plugin for database-audit-logger",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Claude Code Plugins",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
"skills": [
|
||||
"./skills"
|
||||
],
|
||||
"commands": [
|
||||
"./commands"
|
||||
]
|
||||
}
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# database-audit-logger
|
||||
|
||||
Database plugin for database-audit-logger
|
||||
42
commands/audit-log.md
Normal file
42
commands/audit-log.md
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
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.
|
||||
61
plugin.lock.json
Normal file
61
plugin.lock.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||
"pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/database/database-audit-logger",
|
||||
"normalized": {
|
||||
"repo": null,
|
||||
"ref": "refs/tags/v20251128.0",
|
||||
"commit": "1320bfc1d9746d2dc9710fcce7ab55b478c9c5c1",
|
||||
"treeHash": "c0eea8d7a3ad008e5203b64fa224784bccdb42332633531c0834360ad7b619cc",
|
||||
"generatedAt": "2025-11-28T10:18:18.464562Z",
|
||||
"toolVersion": "publish_plugins.py@0.2.0"
|
||||
},
|
||||
"origin": {
|
||||
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||
"branch": "master",
|
||||
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||
},
|
||||
"manifest": {
|
||||
"name": "database-audit-logger",
|
||||
"description": "Database plugin for database-audit-logger",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"content": {
|
||||
"files": [
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "aacdfa26d0b5f989eeb0960171e9ed9b6aeeac718b1e2246672a618456d8b76c"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/plugin.json",
|
||||
"sha256": "60f00ba50248b7b7de9d13a4776f2da7d335116ee4654afd0d0f8c9aec477526"
|
||||
},
|
||||
{
|
||||
"path": "commands/audit-log.md",
|
||||
"sha256": "b740c581eb645060495d3f9b595559ad05ea1a1a7efbdf5b2e2dcd4d11cadd6b"
|
||||
},
|
||||
{
|
||||
"path": "skills/database-audit-logger/SKILL.md",
|
||||
"sha256": "b65bc70869e5da6a2f5ad5efac1b14ebd8012acf6f1a501a09c8535c1fd1798d"
|
||||
},
|
||||
{
|
||||
"path": "skills/database-audit-logger/references/README.md",
|
||||
"sha256": "ad3cbf122d812fb9145ef97b5547afe79b49de2a7193997ab841a6560b13ae5e"
|
||||
},
|
||||
{
|
||||
"path": "skills/database-audit-logger/scripts/README.md",
|
||||
"sha256": "6f94c80631cffdd9de8c510d6e6de46e8478445cfc21aa91c525f49fd1da3043"
|
||||
},
|
||||
{
|
||||
"path": "skills/database-audit-logger/assets/README.md",
|
||||
"sha256": "5e96da402c518fa3ca6e4f2c01af74493b7bb9c3dec4043323791113f9c9a409"
|
||||
}
|
||||
],
|
||||
"dirSha256": "c0eea8d7a3ad008e5203b64fa224784bccdb42332633531c0834360ad7b619cc"
|
||||
},
|
||||
"security": {
|
||||
"scannedAt": null,
|
||||
"scannerVersion": null,
|
||||
"flags": []
|
||||
}
|
||||
}
|
||||
55
skills/database-audit-logger/SKILL.md
Normal file
55
skills/database-audit-logger/SKILL.md
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
name: implementing-database-audit-logging
|
||||
description: |
|
||||
This skill helps implement database audit logging for tracking changes and ensuring compliance. It is triggered when the user requests to "implement database audit logging", "add audit trails", "track database changes", or mentions "audit_log" in relation to a database. The skill provides options for trigger-based auditing, application-level logging, Change Data Capture (CDC), and parsing database logs. It generates a basic audit table schema and guides the user through selecting the appropriate auditing strategy.
|
||||
allowed-tools: Read, Write, Edit, Grep, Glob, Bash
|
||||
version: 1.0.0
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This skill automates the process of setting up database audit logging. It helps users choose an appropriate auditing strategy and provides a basic audit table schema. It simplifies the implementation of robust audit trails for compliance and debugging purposes.
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **Identify Request**: Detects user intent to implement database audit logging.
|
||||
2. **Present Audit Strategies**: Offers a selection of auditing strategies: Trigger-Based, Application-Level, CDC, and Database Logs.
|
||||
3. **Generate Audit Table Schema**: Provides a basic SQL schema for an audit log table.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
This skill activates when you need to:
|
||||
- Implement database audit logging for compliance requirements.
|
||||
- Track changes to specific database tables.
|
||||
- Debug data inconsistencies by reviewing historical changes.
|
||||
- Securely monitor database activity.
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Implementing Audit Logging for a Specific Table
|
||||
|
||||
User request: "Implement database audit logging for the users table."
|
||||
|
||||
The skill will:
|
||||
1. Present the available audit logging strategies (Trigger-Based, Application-Level, CDC, Database Logs).
|
||||
2. Provide the basic audit table schema.
|
||||
3. Guide the user to choose an appropriate method and tailor the schema to the "users" table.
|
||||
|
||||
### Example 2: Adding Audit Trails for Compliance
|
||||
|
||||
User request: "Add audit trails to my database to meet compliance regulations."
|
||||
|
||||
The skill will:
|
||||
1. Present the available audit logging strategies.
|
||||
2. Provide the basic audit table schema.
|
||||
3. Assist in selecting a strategy that aligns with compliance requirements (e.g., CDC for real-time monitoring).
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Strategy Selection**: Choose the audit logging strategy that best suits your application's needs and performance requirements. Trigger-based auditing can impact performance, while CDC might require more complex infrastructure.
|
||||
- **Data Sensitivity**: Consider the sensitivity of the data being audited and implement appropriate security measures to protect the audit logs.
|
||||
- **Retention Policy**: Define a clear retention policy for audit logs to manage storage and comply with regulatory requirements.
|
||||
|
||||
## Integration
|
||||
|
||||
This skill can be used in conjunction with other database management plugins to automate the creation of triggers or configure CDC pipelines. It also integrates with logging and monitoring tools to provide a centralized view of database activity.
|
||||
7
skills/database-audit-logger/assets/README.md
Normal file
7
skills/database-audit-logger/assets/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Assets
|
||||
|
||||
Bundled resources for database-audit-logger skill
|
||||
|
||||
- [ ] audit_log_template.json: JSON template for structuring audit log entries.
|
||||
- [ ] sample_audit_logs/: Directory containing sample audit logs for different database systems and operations.
|
||||
- [ ] audit_dashboard_template.html: HTML template for a basic audit dashboard to visualize audit log data.
|
||||
9
skills/database-audit-logger/references/README.md
Normal file
9
skills/database-audit-logger/references/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# References
|
||||
|
||||
Bundled resources for database-audit-logger skill
|
||||
|
||||
- [ ] database_audit_best_practices.md: Detailed guide on database audit logging best practices, including regulatory compliance (HIPAA, GDPR) and security considerations.
|
||||
- [ ] trigger_based_auditing.md: Explanation of trigger-based auditing, including code examples for creating triggers in different database systems (MySQL, PostgreSQL, SQL Server).
|
||||
- [ ] cdc_implementation.md: Guide on implementing Change Data Capture (CDC) for real-time audit logging.
|
||||
- [ ] database_log_formats.md: Documentation on different database log formats and how to parse them for audit purposes.
|
||||
- [ ] example_audit_policies.md: Examples of audit policies for different database systems and use cases.
|
||||
7
skills/database-audit-logger/scripts/README.md
Normal file
7
skills/database-audit-logger/scripts/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Scripts
|
||||
|
||||
Bundled resources for database-audit-logger skill
|
||||
|
||||
- [ ] audit_log_generator.py: Generates sample audit log entries for various database operations.
|
||||
- [ ] audit_log_analyzer.py: Analyzes existing database logs to identify potential security threats or compliance issues.
|
||||
- [ ] audit_table_creator.sh: Creates a basic audit table in the database with predefined columns (timestamp, user, operation, etc.).
|
||||
Reference in New Issue
Block a user