Advanced Logging Configuration¶
This guide provides detailed information about Poweradmin's advanced logging capabilities and configuration options. For basic logging setup, see the Basic Logging Configuration.
Log Types in Detail¶
Poweradmin supports several logging methods that can be combined for comprehensive monitoring:
1. Native Logging¶
Uses PHP's error_log() function to write logs to the configured PHP error log destination.
2. Null Logging¶
Disables all application logging (except database logging if enabled separately).
3. Database Logging¶
Logs user actions and zone changes to the Poweradmin database. This is independent of the main logger type.
4. Syslog Logging¶
Sends every audit event to the system's syslog - not just authentication, but also zone and record changes, user and group management, and API events.
'logging' => [
'syslog_enabled' => true,
'syslog_identity' => 'poweradmin', // Program identifier in syslog
'syslog_facility' => LOG_USER, // Standard PHP syslog facility constant
// other settings...
],
Authentication events use a fixed, parseable format
(client_ip:X user:Y operation:Z auth_method:W ...) - see
fail2ban Integration for the full event taxonomy and a
ready-to-use filter.
Environment-Specific Configurations¶
Production Environment Configuration¶
For a standard production environment:
'logging' => [
'type' => 'native',
'level' => 'warning', // Only log warning and above
'database_enabled' => true, // Track user actions and zone changes
'syslog_enabled' => true, // Log security events to syslog
'syslog_identity' => 'poweradmin',
'syslog_facility' => LOG_LOCAL0,
],
Development Environment Configuration¶
For a development environment:
'logging' => [
'type' => 'native',
'level' => 'debug', // Log everything including debug messages
'database_enabled' => true, // Track changes for debugging
'syslog_enabled' => false, // Usually not needed in development
],
Minimal Logging Configuration¶
For minimal performance impact:
'logging' => [
'type' => 'null', // Disable application logging
'database_enabled' => false, // Disable database logging
'syslog_enabled' => true, // Keep security logging
'syslog_identity' => 'poweradmin',
'syslog_facility' => LOG_USER,
],
Best Practices¶
- Production environments: Use
warningorerrorlevels to avoid excessive logging - Debug temporary issues: Temporarily enable
debuglevel, then return to normal settings - Database logging: Useful for audit trails but may impact performance on high-traffic systems
- Syslog logging: Recommended for security events to integrate with system monitoring
Advanced Configuration¶
Custom Log Paths¶
If using native logging, you can control the log file location by configuring PHP's error_log setting in your php.ini file.
Log Rotation¶
For production systems, ensure log rotation is configured at the system level: - For syslog: Configure logrotate for your syslog files - For PHP error logs: Configure logrotate for your PHP error log files - For database logs: Implement periodic pruning of old log entries
Database Log Tables¶
When database_enabled is true, logs are stored in:
log_userstable: Authentication and user management eventslog_zonestable: DNS zone and record changeslog_groupstable: Group management and membership changeslog_apitable: Public API requests and permission violations (added in 4.3.0; per-request logging also needsapi_request_logging)log_changesetsandlog_record_changestables: Structured before/after snapshots of record changes, grouped per submitted change (added in 4.5.0)