This project is not covered by Drupal’s security advisory policy.

Security Event Log records security-relevant activity on a Drupal site into its own audit trail, separate from the regular watchdog log.

Watchdog (dblog) is trimmed by cron once it reaches its row limit, and syslog depends on how the host is configured. Security events such as a new administrator account or a dangerous permission change need to be kept for a defined period and be easy to forward to a SIEM. This module stores them in a dedicated table with its own retention, and can also write them as JSON Lines to a file that a log collector (for example Wazuh, Filebeat or Fluent Bit) can read.

Events

  • Successful, failed and flood-blocked logins (blocked attempts are throttled per account and IP)
  • Logout and password reset requests / use
  • User created, blocked, unblocked, cancelled
  • Roles granted or revoked, and role permission changes (with the added and removed permissions; restricted permissions and administrator roles are flagged)
  • Configuration changes and module install / uninstall

Each event type can be enabled or disabled.

Outputs

  • Database table (always on) with a configurable retention period and an admin listing
  • JSON Lines file (optional): one event per line, daily files, created with the correct owner even when the first write comes from drush running as root

Log format

JSON with fixed fields: time, site, event type, severity, acting user, client IP, URL, source (web / cli) and event-specific details. All values are JSON-encoded, so user input cannot inject fields or extra lines. One-time login hashes and tokens in URLs are redacted.

Deployments

Changes made by an automated deployment (for example drush config:import run from CI) can be marked as deployment events through an environment variable, so monitoring rules can treat them differently from manual changes.

Configuration

Everything site-specific (site identifier, file path, enabled events, retention) is configuration and can be overridden in settings.php. The module contains no hard-coded hosts, paths or rules.

Requirements

Drupal 9.5, 10, 11 or 12.

Installation

Install with Composer:

composer require drupal/security_event_log

then enable the module and review the settings at Configuration » System » Security Event Log.

Similar projects

  • Admin Audit Trail: stores admin actions in the database; does not record which permissions were added or removed, and has no file output for log collectors.
  • File Log: writes watchdog messages to files; values are not escaped, and role or permission changes are not logged by core.

Development is sponsored by HelloSanta.

Supporting organizations: 
Employer

Project information

Releases