PHP Classes

Monolog Quill: Log security events to Chronicle using Monolog

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 20 All time: 11,292 This week: 206Up
Version License PHP version Categories
monolog-quill 1.0MIT/X Consortium ...5PHP 5, Web services, Logging, Security
Description 

Author

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
Number 3
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: 37 packages by
Country: United States United States
Age: ???
All time rank: 1173170 in United States United States
Week rank: 44 Up6 in United States United States Up
Innovation award
Innovation award
Nominee: 28x

Winner: 1x

Documentation

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 (7)  
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 (7)  /  .github  
File Role Description
Files folder imageworkflows (1 file)

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

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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:20
This week:0
All time:11,292
This week:206Up