SyndrDB includes a comprehensive security audit logging system that tracks authentication events, session lifecycle, rate limiting actions, access control decisions, and system security events. Audit logs are stored as JSON-lines files with automatic rotation and retention management.
Audit logging is automatically enabled when authentication is active. No additional commands are needed.
| Event Type | Severity | Description |
|---|---|---|
AUTH_SUCCESS |
INFO | User authenticated successfully |
AUTH_FAILURE |
WARNING | Authentication attempt failed |
AUTH_LOCKOUT |
WARNING | Account locked after excessive failures |
AUTH_UNLOCK |
INFO | Account unlocked |
| Event Type | Severity | Description |
|---|---|---|
SESSION_CREATED |
INFO | New session established |
SESSION_EXPIRED |
INFO | Session timeout/expiration |
SESSION_DESTROYED |
INFO | Session manually closed |
SESSION_HIJACK |
CRITICAL | Potential session hijack detected |
| Event Type | Severity | Description |
|---|---|---|
RATE_LIMIT_HIT |
WARNING | Rate limit exceeded |
IP_BLOCKED |
WARNING | IP address blocked (excessive failures) |
IP_UNBLOCKED |
INFO | IP address unblocked |
PROGRESSIVE_DELAY |
INFO | Progressive delay applied |
| Event Type | Severity | Description |
|---|---|---|
ACCESS_DENIED |
WARNING | Permission check failed |
PRIVILEGE_ESCALATION |
CRITICAL | Unauthorized privilege escalation attempt |
UNAUTHORIZED_ACCESS |
WARNING | Attempt to access unauthorized resource |
| Event Type | Severity | Description |
|---|---|---|
SECURITY_CONFIG_CHANGE |
WARNING | Security configuration modified |
AUDIT_LOG_TAMPER |
CRITICAL | Audit log tampering detected |
SYSTEM_COMPROMISE |
CRITICAL | Critical system compromise detected |
Each audit event is recorded as a JSON object. One JSON object is written per line in the log file (JSON-lines format):
{
"id": "evt_1705627667000000000_1705627667",
"timestamp": "2026-01-19T02:54:27Z",
"event_type": "AUTH_SUCCESS",
"severity": "INFO",
"username": "alice",
"session_id": "sess_abc123",
"ip_address": "192.168.1.100",
"port": 5432,
"user_agent": "syndrdb-cli/1.0",
"description": "User 'alice' authenticated successfully",
"details": {
"auth_method": "password"
},
"success": true,
"error_code": ""
}
| Field | Description |
|---|---|
id |
Unique event identifier (evt_<timestamp>_<unix>) |
timestamp |
UTC timestamp |
event_type |
One of the security event types above |
severity |
INFO, WARNING, or CRITICAL |
username |
Username involved (if applicable) |
session_id |
Session identifier (if applicable) |
ip_address |
Client IP address |
port |
Client port |
user_agent |
Client user-agent string |
description |
Human-readable event description |
details |
Additional contextual data (map) |
success |
Whether the operation succeeded |
error_code |
Error code if failed |
Audit logging is configured via the AuditConfig:
| Setting | Default | Description |
|---|---|---|
LogDirectory |
log_files/security | Directory for audit log files |
MaxFileSize |
50 MB | Maximum size per log file before rotation |
MaxFiles |
100 | Maximum number of log files to retain |
FlushInterval |
5 seconds | How often to flush buffer to disk |
BufferSize |
100 events | Buffer size before forced flush |
EnableEncryption |
false | Whether to encrypt audit logs |
EncryptionKey |
"" | Key for log encryption |
The log directory is created with secure permissions (0700 — owner read/write/execute only).
Audit log files are written to:
{LogDir}/security/security_audit_YYYY-MM-DD_HH-MM-SS.log
When a log file exceeds MaxFileSize (50MB default), a new file is created with a fresh timestamp.
After rotation, files exceeding the MaxFiles count are deleted (oldest first). Default retention: 100 files × 50MB = ~5GB maximum.
Events are flushed to disk when:
BufferSize (100 events)Each flush includes an fsync call for durability.
Audit logs are stored as JSON-lines files (one JSON object per line). They can be accessed by:
# View recent events
tail -f log_files/security/security_audit_*.log
# Search for failed authentications
grep "AUTH_FAILURE" log_files/security/security_audit_*.log
# Count events by type
grep -c "AUTH_LOCKOUT" log_files/security/security_audit_*.log
The SecurityAuditor provides a GetStats() method returning buffer state, channel capacity, and configuration.
SyndrDB supports an AuditEventExtension interface for enterprise integrations:
MaxFiles and MaxFileSize for your compliance needsAUTH_FAILURE patterns for potential brute-force attacksSESSION_HIJACK or SYSTEM_COMPROMISE eventsLast updated: March 2026