Skip to content

Integrates Monolog with Seq using HTTP ingestion, enabling structured event logging to a centralized Seq server for enhanced log management.

License

Notifications You must be signed in to change notification settings

Pablo1Gustavo/monolog-seq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monolog Seq

Integrates PHP Monolog with Seq using HTTP ingestion, enabling structured event logging to a centralized Seq server for enhanced log management.

Installation

Install the latest version with

composer require pablo1gustavo/monolog-seq

Usage

This package automatically sets the CLEF request keys, including @t, @m, @mt, @l, and @x, ensuring seamless structured logging.

For more detailed usage instructions, refer to the official Seq documentation.

Usage (Vanilla PHP)

You can find an example in example.php.

$seqUrl = "http://localhost:5341/api/events/raw";
$seqApiKey = "H16XK1wLgC0LDsen5fwA";

$logger = new Logger('seq');
$logger->pushHandler(new SeqHandler($seqUrl, $seqApiKey));

$logger->critical('error', ['excepasdtion' => new Exception('error')]);
$logger->warning('warn message', ['abc' => "123", 'def' => [1,2,3]]); 
$logger->info("hello my name is {name}", ['name' => 'pablo']);
$logger->debug("debug message", ['date' => new DateTime("2002-01-13")]);
$logger->emergency("teste");

Usage (Laravel)

Laravel allows you to configure custom Monolog handlers, such as this package, within its logging configuration file.

For step-by-step instructions, refer to the Laravel Logging - Creating Monolog Handler Channels documentation.

Example:

        'seq' => [
            'driver' => 'monolog',
            'level' => env('LOG_LEVEL', 'debug'),
            'handler' => \Pablo1Gustavo\MonologSeq\Handler\SeqHandler::class,
            'formatter' => \Pablo1Gustavo\MonologSeq\Formatter\SeqJsonFormatter::class,
            'with' => [
                'url' => env('SEQ_URL'),
                'apiKey' => env('SEQ_API_KEY'),
            ],
        ]

About

Integrates Monolog with Seq using HTTP ingestion, enabling structured event logging to a centralized Seq server for enhanced log management.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages