Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Gelf Logger

Laravel Gelf Logger Laravel Package

hedii/laravel-gelf-logger

A Laravel package that adds a GELF log driver so your application can send structured logs directly to Graylog. Configure the host, port, and transport, then use Laravel’s logging system to ship messages with levels and context.

View on GitHub
Deep Wiki
Context7

A Laravel package to send logs to a gelf compatible backend like graylog

Frequently asked questions about Laravel Gelf Logger
How do I install hedii/laravel-gelf-logger in a Laravel application?
Install it with Composer using composer require hedii/laravel-gelf-logger. Laravel package auto-discovery registers the service provider, so no manual provider entry is needed in most setups. Publish the package config if it ships one, then define a gelf channel in config/logging.php and point LOG_CHANNEL or LOG_STACK at it.
Which Laravel and PHP versions does this GELF logger support?
The package targets Laravel applications that log through Monolog, but you should verify the exact supported ranges against its composer.json and CI matrix before committing. Logging adapters are exposed to Monolog major-version changes, notably the handler rework in Monolog 3, and to Laravel's own logging refactors. Check that your target Laravel and PHP majors appear in the CI matrix rather than assuming compatibility.
How do I configure a Graylog channel in config/logging.php?
Add a channel entry to the channels array in config/logging.php with the package's gelf driver, plus host, port, and transport keys. Keep credentials and hostnames in .env so each environment can target a different collector. Then reference the channel by name from LOG_CHANNEL, or include it in LOG_STACK alongside your existing channels.
Does laravel-gelf-logger support UDP, TCP, and TLS transports?
Yes, the driver can ship GELF messages to a Graylog-compatible collector over UDP, TCP, or TLS, with the transport chosen in the channel configuration. Each has different semantics: UDP is fire-and-forget and can silently drop messages under burst load or MTU fragmentation, while TCP and TLS are connection-oriented and put network I/O in the request path. Confirm the handler's timeout, chunking, and compression behavior in the source before picking a transport for production.
Do I need to change my application code to use this package?
No. It registers a Laravel logging channel, so anything already using the Log facade or the logger helper continues to work unchanged. Levels and context arrays are carried into the GELF payload automatically. The only edits are configuration: a channel array, a few environment variables, and the stack or default channel setting.
Can I send logs to both local files and Graylog at the same time?
Yes, and that dual-write pattern is the recommended one. Keep your single or daily file channel for local forensics and add a gelf channel for centralized search, then list both in LOG_STACK. This is a non-destructive change that composes with your existing logging stack instead of replacing it, and it is easy to roll back by editing the stack value.
What happens to my requests if Graylog is unreachable?
Behavior depends on the transport and on whether the handler sets a timeout. UDP is fire-and-forget, so a collector outage normally means dropped log lines rather than application errors, whereas TCP or TLS can block the request path and couple latency to the collector's availability. Read the handler source or test against a stopped collector on staging to confirm whether failures throw or fail silently, and consider asynchronous delivery if that risk matters to you.
Does it work with Laravel Octane or long-running queue workers?
It is a Monolog handler behind a Laravel channel, so it can be used under Octane and in workers, but stale socket handling across long-lived processes is a real concern worth validating. Test reconnect behavior after the collector restarts or a TCP connection goes idle. If the handler holds persistent connections without reconnect logic, prefer UDP or a fresh connection per batch in your staging checks.
Can I add static fields like service name, environment, or release to every log?
GELF payloads carry structured fields, and the practical approach is to inject service, environment, release, and request ID centrally through the channel configuration so every record is tagged consistently. Whether the package exposes a config option for this is not obvious from the description, so check the published config and the handler source first. If it is not supported directly, a thin wrapper or a small custom Monolog handler gets you there.
How does it compare to graylog2/gelf-php or a custom Monolog handler?
This package is a thin convenience adapter, not a platform. Non-Laravel PHP services in your estate would typically use graylog2/gelf-php directly, and a mixed-language estate should standardize on the GELF contract rather than on this package. Because the codebase is small, a fork or roughly fifty lines of in-house Monolog handler configuration is a credible exit, so lock-in is low.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core