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

Useit Loki Logger integrates Drupal logging with Grafana Loki collection pipelines by writing log events as structured, single-line JSON to the PHP error log.

The module captures events from all Drupal logging channels and severity levels. Each record includes the severity name and number, logging channel, interpolated message, and user ID when available. It supports both Drupal and PSR-3 message placeholders.

Features

  • Structured JSON output for external log collection and parsing.
  • Compatible with Drupal 10 and 11.
  • Supports all eight RFC 5424 severity levels, from emergency to debug.
  • Handles Unicode and replaces invalid UTF-8 during JSON encoding.
  • Limits messages to 4,000 characters.
  • Prevents logging failures from interrupting application requests.
  • Works alongside Drupal’s Database Logging module and other logging backends.
  • No contributed module dependencies or Drupal configuration required.

How it works

Enable the module and configure PHP’s error log destination. An external collector, such as Grafana Alloy, reads the logs and forwards them to Loki.
The module does not communicate directly with Loki. PHP logging, container log collection, and the forwarding pipeline are configured separately in your deployment environment.

Requirements

  • Drupal 10 or 11.
  • A writable PHP error log destination.
  • An external log collector and a Loki instance for Loki ingestion.

Project information

  • caution Minimally maintained
    Maintainers monitor issues, but fast responses are not guaranteed.
  • caution Maintenance fixes only
    Considered feature-complete by its maintainers.
  • chart icon3 sites report using this module
  • Created by aprats on , updated
  • shield alertThis project is not covered by the security advisory policy.
    Use at your own risk! It may have publicly disclosed vulnerabilities.

Releases