sundayhaxors/monolog-sign-logs

A Monolog Processor which signs log-entries with a private hash to prevent log manipulation

dev-master 2020-12-15 14:51 UTC

This package is auto-updated.

Last update: 2024-12-15 23:09:00 UTC


README

Build Status PHP Version Stable Version

Monolog processor that will cryptographically sign all the log messages for you.

Installation

$ composer require sundayhaxors/monolog-sign-logs

Usage

<?php

use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use SundayHaxors\Monolog\SignLogs\Processor\SignLogsProcessor;

$log = new Logger('logger');
$log->pushHandler(new StreamHandler('path/to/log', Logger::WARNING));

$processor = new SignLogsProcessor('YOUR-SECRET-KEY','Hashing Algorithm');
$log->pushProcessor($processor);

$log->log(Logger::DEBUG, 'This is a log message');

For the available Hashing Algorithms in your PHP Installation, please check the output of the function hash_algos();

In case you use several Processors in your Stack, take care that the SignLogsProcessor is running last.

License

Package is licensed under the LGPL License - see the LICENSE file for details