Search by

tomatophp / laravel-logstash

fadymondy

Elastic Logstash integration for Laravel Apps

Package info

github.com/tomatophp/laravel-logstash

pkg:composer/tomatophp/laravel-logstash

Fund package maintenance!

3x1io

Statistics

Installs: 343

Dependents: 0

Suggesters: 0

Stars: 7

Open Issues: 0

2.0.0 2026-09-17 13:36 UTC

This package is auto-updated.

Last update: 2026-09-17 13:38:41 UTC


README

Screenshot

Laravel Logstash Log Channel

Dependabot Updates PHP Code Styling Tests Latest Stable Version License Downloads

Elastic Logstash log channel for Laravel apps. Every log record is formatted with Monolog's LogstashFormatter and posted as JSON to a Logstash HTTP input, through a queued job by default.

Compatibility

Version Laravel PHP Branch
2.x 12.x, 13.x 8.2+ master
1.x 10.x, 11.x 8.1+ v1

Installation

composer require tomatophp/laravel-logstash

The service provider is auto-discovered and registers a logstash log channel. Add the Logstash HTTP input URL (host with port) to your .env and use the channel:

LOGSTASH_HOST=https://logstash.example.com:8080
LOG_CHANNEL=logstash

To keep your local log file as well, add logstash to the stack channel instead:

LOG_CHANNEL=stack
LOG_STACK=single,logstash

When LOGSTASH_HOST is empty nothing is sent. A failing or unreachable Logstash never throws, so logging can not break your app.

Queue

Records are sent by the TomatoPHP\LaravelLogstash\Jobs\NotifyLogstash job, so run a queue worker (or use the sync queue). To send directly over HTTP during the request, set LOGSTASH_QUEUE=false.

Configuration

Env Default Description
LOGSTASH_HOST null Logstash HTTP input URL
LOGSTASH_LEVEL debug Minimum level sent to Logstash
LOGSTASH_QUEUE true Send through the queued job
LOGSTASH_QUEUE_CONNECTION null Queue connection for the job (app default)
LOGSTASH_QUEUE_NAME null Queue name for the job (app default)
LOGSTASH_TIMEOUT 5 HTTP timeout in seconds

You can publish the config file with:

php artisan vendor:publish --tag="laravel-logstash-config"

To customise the channel, define it yourself in config/logging.php; the package will not overwrite it. Channel keys override the package config:

'logstash' => [
    'driver' => 'custom',
    'via' => \TomatoPHP\LaravelLogstash\Logs\LogStashLogger::class,
    'url' => env('LOGSTASH_HOST'),
    'level' => 'error',
    'queue' => true,
    'queue_connection' => 'redis',
    'queue_name' => 'logs',
],

Changelog

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

Security

Please see SECURITY for more information about security.

Credits

License

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

Testing

if you like to run PEST testing just use this command

composer test

Code Style

if you like to fix the code style just use this command

composer format

PHPStan

if you like to check the code by PHPStan just use this command

composer analyse

Other Filament Packages

Checkout our Awesome TomatoPHP