-
-
Notifications
You must be signed in to change notification settings - Fork 2
plugin audit log
Append-only audit log for security-relevant events. Captures auth activity, privilege changes, secret access, and plugin install/uninstall. Queryable from Admin with filters by event type, actor, severity, and time range.
Security-Always-Free: This plugin has no license requirement. Audit logging is a core security feature available to all nSelf users at no cost.
nself plugin install audit-log
nself build
nself start| Column | Type | Description |
|---|---|---|
id |
TEXT (PK) | Unique event ID (UUID) |
source_account_id |
TEXT DEFAULT 'primary' | Multi-app isolation — which app in this nSelf deploy generated the event |
actor_user_id |
TEXT | User who performed the action (null for system events) |
actor_type |
TEXT |
user, system, plugin, api_key
|
event_type |
TEXT | Dot-notation event identifier, e.g. auth.login.success, plugin.install
|
resource_type |
TEXT | What was acted on: user, secret, plugin, table, etc. |
resource_id |
TEXT | ID of the affected resource |
ip_address |
TEXT | Client IP at time of event |
user_agent |
TEXT | HTTP User-Agent header |
metadata |
JSONB | Structured event-specific data |
severity |
TEXT |
info, warn, error, critical
|
created_at |
TIMESTAMPTZ | Event timestamp (partitioned by this column) |
The table is partitioned by RANGE (created_at) for scalable long-term retention.
RLS policies block UPDATE and DELETE on np_auditlog_events. Events are immutable once written. This is enforced at the database level — not just the application layer.
All endpoints require the X-Plugin-Secret header (set to PLUGIN_INTERNAL_SECRET).
| Method | Path | Description |
|---|---|---|
GET |
/health |
Health check — returns {"status":"ok"}
|
POST |
/events |
Write one or more audit events |
GET |
/events |
Query events with filters |
GET |
/events/{id} |
Fetch a single event by ID |
GET |
/events/export |
Export events as JSON or CSV |
GET |
/admin/events |
Admin query — also accepts HASURA_GRAPHQL_ADMIN_SECRET header |
curl -X POST http://127.0.0.1:3308/events \
-H "X-Plugin-Secret: $PLUGIN_INTERNAL_SECRET" \
-H "Content-Type: application/json" \
-d '{
"event_type": "auth.login.success",
"actor_user_id": "user-abc",
"actor_type": "user",
"resource_type": "session",
"resource_id": "session-xyz",
"severity": "info",
"ip_address": "192.168.1.100",
"metadata": {"mfa_used": true}
}'| Query param | Description |
|---|---|
event_type |
Filter by event type (exact or prefix) |
actor_user_id |
Filter by actor |
actor_type |
Filter by actor type |
severity |
Filter by severity level |
resource_type |
Filter by resource type |
resource_id |
Filter by resource ID |
from |
Start of time range (ISO 8601) |
to |
End of time range (ISO 8601) |
limit |
Max results (default 100, max 1000) |
cursor |
Pagination cursor from previous response |
source_account_id |
Filter by app (multi-app deployments) |
# Get all auth events from the last 24 hours
curl "http://127.0.0.1:3308/events?event_type=auth&from=2026-05-16T00:00:00Z" \
-H "X-Plugin-Secret: $PLUGIN_INTERNAL_SECRET"# Export as CSV
curl "http://127.0.0.1:3308/events/export?format=csv&from=2026-05-01T00:00:00Z" \
-H "X-Plugin-Secret: $PLUGIN_INTERNAL_SECRET" \
-o audit-may-2026.csv
# Export as JSON
curl "http://127.0.0.1:3308/events/export?format=json&severity=critical" \
-H "X-Plugin-Secret: $PLUGIN_INTERNAL_SECRET"| Env var | Required | Description |
|---|---|---|
DATABASE_URL |
Yes | PostgreSQL connection string |
PORT |
No | Plugin port (default: 3308) |
HASURA_GRAPHQL_ADMIN_SECRET |
No | Enables the /admin/events endpoint for Hasura-level admin queries |
PLUGIN_INTERNAL_SECRET |
No | Shared secret for X-Plugin-Secret header authentication |
| Event type | Triggered by |
|---|---|
auth.login.success |
Successful login |
auth.login.failure |
Failed login attempt |
auth.logout |
User logout |
auth.mfa.enabled |
MFA turned on |
auth.mfa.disabled |
MFA turned off |
auth.password.changed |
Password change |
plugin.install |
Plugin installed |
plugin.uninstall |
Plugin removed |
secret.accessed |
Vault secret read |
secret.rotated |
Vault secret rotated |
privilege.granted |
Role/permission added |
privilege.revoked |
Role/permission removed |
The nSelf Admin UI (localhost:3021) includes an Audit Log viewer under Security. You can filter by event type, actor, severity, and date range without writing SQL.
For custom queries, connect directly to Postgres:
SELECT event_type, actor_user_id, severity, created_at, metadata
FROM np_auditlog_events
WHERE event_type LIKE 'auth%'
AND created_at > NOW() - INTERVAL '7 days'
ORDER BY created_at DESC
LIMIT 100;- Port 3308 binds to
127.0.0.1— never exposed externally. - Events are immutable at the database level (RLS blocks UPDATE/DELETE).
- No license required — audit logging is free for all nSelf users (Security-Always-Free).
-
nself doctor --deepincludes checkPERM-RLS-01to verify append-only RLS is active.
- Security overview
- plugin-nself-scan — vulnerability scanner (also free)
ɳSelf CLI v1.0.9. MIT licensed. Docs CC BY 4.0.
GitHub · Issues · Discussions · nself.org · docs.nself.org
Getting Started
Commands
- Commands, Overview
- Lifecycle: cmd-init · cmd-build · cmd-start · cmd-stop · cmd-restart · cmd-dev
- Monitoring: cmd-status · cmd-logs · cmd-health · cmd-urls · cmd-doctor · cmd-monitor · cmd-alerts · cmd-watchdog · cmd-dogfood
- Data: cmd-db · cmd-backup · cmd-dr · cmd-queue · cmd-webhooks
- Config: cmd-config · cmd-service · cmd-env · cmd-promote
- Networking: cmd-ssl · cmd-trust · cmd-dns-setup
- Security: cmd-security · cmd-secrets · cmd-waf
- Tenancy: cmd-tenant · cmd-billing
- Plugins: cmd-plugin · cmd-license
- AI: cmd-ai · cmd-claw · cmd-model
- Templates: cmd-template
- Utilities: cmd-exec · cmd-clean · cmd-reset · cmd-update · cmd-upgrade · cmd-version · cmd-admin · cmd-migrate · cmd-migrate-firebase · cmd-migrate-supabase · cmd-completion
Features
- Features, Overview
- Feature-Auth
- Feature-Storage
- Feature-Search
- Feature-Functions
- Feature-Email
- Feature-Monitoring
- Feature-Plugins
- Feature-ɳClaw, AI Assistant
- Feature-ɳChat, Messaging
- Feature-ɳTV, Media Player
- Feature-ɳFamily, Family Social
- Feature-ɳCloud, Managed Hosting
- Feature-Memory-Rooms, Knowledge Organization
- Feature-Agent-Dashboard, Agent Metrics
- Feature-Image-Generation, AI Image Generation
Configuration
- Configuration, Overview
- Config-Env-Vars
- Config-Postgres
- Config-Hasura
- Config-Auth
- Config-Nginx
- Config-Optional-Services
- Config-Custom-Services
- Config-System
Plugins (87 + 10 monitoring)
Free (25)
- plugin-backup
- plugin-content-acquisition
- plugin-content-progress
- plugin-cron
- plugin-donorbox
- plugin-feature-flags
- plugin-github
- plugin-github-runner
- plugin-invitations
- plugin-jobs
- plugin-link-preview
- plugin-mdns
- plugin-mlflow
- plugin-monitoring
- plugin-notifications
- plugin-notify
- plugin-paypal
- plugin-search
- plugin-shopify
- plugin-stripe
- plugin-subtitle-manager
- plugin-tokens
- plugin-torrent-manager
- plugin-vpn
- plugin-webhooks
Pro (62)
- plugin-access-controls
- plugin-activity-feed
- plugin-admin-api
- plugin-ai
- plugin-analytics
- plugin-auth
- plugin-backup-pro
- plugin-bots
- plugin-browser
- plugin-calendar
- plugin-cdn
- plugin-chat
- plugin-claw
- plugin-claw-budget
- plugin-claw-news
- plugin-claw-web
- plugin-cloudflare
- plugin-cms
- plugin-compliance
- plugin-cron-pro
- plugin-ddns
- plugin-devices
- plugin-documents
- plugin-donorbox-pro
- plugin-entitlements
- plugin-epg
- plugin-file-processing
- plugin-game-metadata
- plugin-geocoding
- plugin-geolocation
- plugin-google
- plugin-home
- plugin-idme
- plugin-knowledge-base
- plugin-linkedin
- plugin-livekit
- plugin-media-processing
- plugin-meetings
- plugin-moderation
- plugin-mux
- plugin-notify-pro
- plugin-object-storage
- plugin-observability
- plugin-paypal-pro
- plugin-photos
- plugin-podcast
- plugin-post
- plugin-realtime
- plugin-recording
- plugin-retro-gaming
- plugin-rom-discovery
- plugin-shopify-pro
- plugin-social
- plugin-sports
- plugin-stream-gateway
- plugin-streaming
- plugin-stripe-pro
- plugin-support
- plugin-tmdb
- plugin-voice
- plugin-web3
- plugin-workflows
Planned (26)
plugin-auditplugin-blogplugin-checkoutplugin-commerceplugin-drmplugin-exportplugin-flowplugin-importplugin-ldapplugin-mailgunplugin-mediaplugin-oauth-providersplugin-pagesplugin-postmarkplugin-rate-limitplugin-reportsplugin-samlplugin-schedulerplugin-sendgridplugin-ssoplugin-subscriptionplugin-thumbplugin-transcoderplugin-twilioplugin-wafplugin-watermark
Guides
- Guide-Production-Deployment
- Guide-SSL-Setup
- Guide-Multi-Tenancy
- Guide-Security-Hardening
- Guide-Monitoring-Setup
- Guide-Backup-Restore
- Guide-Custom-Services
- Guide-Migration-from-v1
Architecture
Reference
- API-Reference
- reference-error-codes, Error Codes
Licensing
Security
Brand
Operations
- operations/release-cascade, Release Cascade
- operations/self-healing, Self-Healing Schema
- operations/redis-tuning, Redis Pool Tuning
- operations/meilisearch-warmup, MeiliSearch Warm-Up
- operations/jwt-rotation, JWT Key Rotation
- operations/windows-wsl2-setup, Windows / WSL2 Setup
- operations/gemini-oauth-reauth, Gemini OAuth Reauth
Contributing
Admin
- USER-ACTION-QUEUE, Pending Admin Actions