Skip to content

Log Forwarding / Log Destinations #573

@bonny

Description

@bonny

Simple History should support forwarding/sending events to other destinations for backup, compliance, and security purposes.

Problem Description

Simple History currently stores events only in the local WordPress database and displays them in the WordPress admin interface. This issue extends functionality by adding support for forwarding events to other destinations.

Use Cases

  1. Compliance: Maintain logs for compliance requirements (SOC 2, GDPR, HIPAA, PCI DSS)
  2. Security: Have backup logs that hackers cannot modify if they gain access to the system

Log Destinations

A destination can be:

  • Text file (local backup)
  • System syslog
  • rsyslog server (remote)
  • Remote database (MySQL/MariaDB)
  • Cloud logging services (Papertrail/SolarWinds, Graylog, etc.)

Implementation

  • Hook into simple_history/log/inserted action that fires after events are inserted into the database
  • Create a common interface for different destination targets
  • Focus on performance - avoid slowing down the site

Current Status: Complete ✅

All log destination channels are implemented and production-ready:

  • File Channel (Free) - Local log files with rotation and security
  • Syslog Channel (Premium) - Local syslog and remote rsyslog (UDP/TCP)
  • External Database Channel (Premium) - MySQL/MariaDB for off-site compliance storage

Implementation Details

File Integration (Free):

  • High-performance write buffering
  • Rotation options: daily, weekly, monthly
  • Human-readable log format
  • Security: .htaccess protection, directory listing prevention

Syslog Channel (Premium):

  • Local syslog via PHP syslog()
  • Remote rsyslog via UDP/TCP sockets
  • RFC 5424 format
  • Test Connection button
  • Auto-disable after consecutive failures

External Database Channel (Premium):

  • MySQL/MariaDB support
  • Hybrid schema with JSON context column
  • Password encryption (AES-256-CBC)
  • SSL/TLS support
  • Test Connection button
  • Auto-disable after consecutive failures

Future Possibilities

  • Graylog (GELF protocol)
  • Elasticsearch/ELK Stack
  • SolarWinds/Papertrail
  • AWS CloudWatch Logs
  • S3 archive

Related Issues

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions