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.
Ask your assistant about Useit Loki Logger
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.