Drupal is a registered trademark of Dries Buytaert

monolog_logz

60 sites Security covered
View on drupal.org

Ship logs to Logz.io via Monolog. This glue module allows shipping handler provided by the logzio-monolog library to be exposed to the Drupal Monolog module and configured using the Drupal config system.

Features

  1. Registers a monolog.handler.logz service that can be then configured into the monolog service.
  2. Sources handler configuration from the Drupal configuration system under a monolog_logz.settings configuration item.

Due to #2951046: Allow parsing and writing PHP class constants and enums in YAML files, it is not currently possible to configure the logzio-monolog library's handler directly in a Drupal services.yml file as the library specifies PHP Enumerations as arguments and Drupal is not setting the YAML parser flags in a way that allows these typed arguments.

Even if passing enums in a Drupal services.yml were possible, it is a common pattern to configure site-specific values in settings.php or the Drupal config system. Some users may not wish to hard-code their Logz.io token in a *.services.yml file but rather inject it via the environment or a secrets-management system.

Post-Installation

Like the Monolog module, this module does not have any visible user interface and is configured by adding values to the Drupal configuration, usually in settings.php. Additionally you must tell monolog to use it in a monolog.services.yml (or equivalent) file used to configure monolog (as described in the Monolog module's README).

  1. Install this module (and the Monolog module) with composer to ensure you are also getting the logzio-monolog library.
  2. Add your configuration details to your settings.php:
    // Part of the Monolog module setup:
    $settings['container_yamls'][] = 'sites/default/monolog.services.yml';
    
    // Configure the Logz.io shipping handler:
    $config['monolog_logz.settings']['token'] = 'my-logz.io-token';
    $config['monolog_logz.settings']['level'] = 'Debug';
    $config['monolog_logz.settings']['host'] = 'UsEast1';
    
  3. Configure the logz handler provided by this module into the monolog service in a monolog.services.yml:
    parameters:
      monolog.channel_handlers:
        php: ['error_log', 'logz']
        default: ['logz']
    

Additional Requirements

Activity

Total releases
1
First release
Feb 2025
Latest release
1 year ago
Release cadence
Stability
100% stable

Releases

Version Type Release date
1.0.1 Stable Feb 17, 2025