vmorozov/laravel-json-log-formatter

Package to quickly set up log formatter in json format that is supported by elk stack

v1.0 2025-03-14 14:15 UTC

This package is auto-updated.

Last update: 2025-03-14 14:15:53 UTC


README

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

composer require vmorozov/laravel-json-log-formatter

You can publish the config file with:

php artisan vendor:publish --tag="json-log-formatter-config"

Add the following to your config/logging.php file to the channel that you want in json format:

'formatter' => \VMorozov\LaravelJsonLogFormatter\JsonLogsFormatter::class,

for example for 'daily' channel it should look like this:

'daily' => [
    'driver' => 'daily',
    'path' => storage_path('logs/laravel.log'),
    'level' => env('LOG_LEVEL', 'debug'),
    'days' => env('LOG_DAILY_DAYS', 15),
    'replace_placeholders' => true,
    'formatter' => \VMorozov\LaravelJsonLogFormatter\JsonLogsFormatter::class,
],

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.