PHP Classes

Monolog Quill: Log security events to Chronicle using Monolog

Recommend this page to a friend!
  Info   View files Documentation   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2022-08-01 (8 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 13 This week: 7All time: 10,941 This week: 18Up
Version License PHP version Categories
monolog-quill 1.0MIT/X Consortium ...5PHP 5, Web services, Logging, Security
Description 

Author

Paragon Initiative Enterprises


Contributor

This package can log security events to Chronicle using Monolog.

It provides a handler class that can process log entries passed to Monolog.

The Monolog handler class forwards the log entry information to a Chronicle server using a Quill class.

Innovation Award
PHP Programming Innovation award nominee
March 2023
Nominee
Vote
Chronicle is an application that can store arbitrary data in an encrypted container.

A Chronicle instance can be made available over a network using client and server components like Gossamer and Quill.

This package provides a handler for the Monolog logging class to allow developers to log events in their applications securely by accessing a Chronicle instance via a Quill client.

This way, this package can help store logging information in a secure container that runs in a separate network machine is possible.

Manuel Lemos
Picture of Scott Arciszewski
  Performance   Level  
Name: Scott Arciszewski <contact>
Classes: 36 packages by
Country: United States United States
Innovation award
Innovation award
Nominee: 28x

Winner: 1x

Details

Monolog-Quill

Build Status Latest Stable Version Latest Unstable Version License Downloads

Requires PHP 7.1 or newer.

Want to use Monolog to write security events to a Chronicle?

This library uses Quill to transcribe log messages to a Chronicle instance. This can be a public or private Chronicle.

Installation

composer require paragonie/monolog-quill

Usage

<?php

use Monolog\Logger;
use ParagonIE\MonologQuill\QuillHandler;
use ParagonIE\Quill\Quill;
use ParagonIE\ConstantTime\Base64UrlSafe;
use ParagonIE\Sapient\CryptographyKeys\{
    SigningSecretKey,
    SigningPublicKey
};

// Create a Quill for writing data to the Chronicle instance 
$quill = (new Quill())
    ->setChronicleURL('https://chronicle-public-test.paragonie.com/chronicle')
    ->setServerPublicKey(
        new SigningPublicKey(
            Base64UrlSafe::decode('3BK4hOYTWJbLV5QdqS-DFKEYOMKd-G5M9BvfbqG1ICI=')
        )
    )
    ->setClientID('Your Client ID provided by the Chronicle here')
    ->setClientSecretKey(
        new SigningSecretKey('/Loaded from the filesystem or something./')
    );

// Push the Handler to Monolog
$log = new Logger('security');
$handler = (new QuillHandler($quill, Logger::ALERT));
$log->pushHandler($handler);

// Now security events will be logged in your Chronicle
$log->alert(
    'User bob logged in at ' .
    ((new DateTime())->format(\DateTime::ATOM))
);

Encrypted Message Logging

Simply pass an instance of SealingPublicKey or SharedEncryptionKey to the handler, via the setEncryptionKey() method, to encrypt log messages.

$handler->setEncryptionKey(
    new SealingPublicKey('/Loaded from the filesystem or something./')
);

Encrypted Message Logging - Complete Example

<?php

use Monolog\Logger;
use ParagonIE\MonologQuill\QuillHandler;
use ParagonIE\Quill\Quill;
use ParagonIE\ConstantTime\Base64UrlSafe;
use ParagonIE\Sapient\CryptographyKeys\{
    SealingPublicKey,
    SigningSecretKey,
    SigningPublicKey
};

// Create a Quill for writing data to the Chronicle instance 
$quill = (new Quill())
    ->setChronicleURL('https://chronicle-public-test.paragonie.com/chronicle')
    ->setServerPublicKey(
        new SigningPublicKey(
            Base64UrlSafe::decode('3BK4hOYTWJbLV5QdqS-DFKEYOMKd-G5M9BvfbqG1ICI=')
        )
    )
    ->setClientID('Your Client ID provided by the Chronicle here')
    ->setClientSecretKey(
        new SigningSecretKey('/Loaded from the filesystem or something./')
    );

// Push the Handler to Monolog
$log = new Logger('security');
$handler = (new QuillHandler($quill, Logger::ALERT));

// Set this to an instance of SealingPublicKey or SharedEncryptionKey:
$handler->setEncryptionKey(
    new SealingPublicKey('/Loaded from the filesystem or something./')
);

$log->pushHandler($handler);

// Now security events will be logged in your Chronicle
$log->alert(
    'User bob logged in at ' .
    ((new DateTime())->format(\DateTime::ATOM))
);
  Files folder image Files  
File Role Description
Files folder image.github (1 directory)
Files folder imagesrc (1 file)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file psalm.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Read me

  Files folder image Files  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file ci.yml Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
  Accessible without login Plain text file QuillHandler.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:13
This week:7
All time:10,941
This week:18Up