Download the PHP package shadowbane/laravel-gelf-logger without Composer

On this page you can find all versions of the php package shadowbane/laravel-gelf-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-gelf-logger

Laravel GELF Logger

A custom Laravel Monolog logger for sending logs to Graylog via the GELF (Graylog Extended Log Format) protocol.

License: MIT

Features

Requirements

Installation

Install the package via Composer:

The service provider will be automatically registered via Laravel's package auto-discovery.

Configuration

Environment Variables

Add the following to your .env file:

Configuration Options

Variable Description Default
GELF_LOGGER_HOST Graylog server hostname or IP address 127.0.0.1
GELF_LOGGER_PORT GELF input port on the Graylog server 12201
GELF_LOGGER_TRANSPORT Transport protocol (udp or tcp) udp
GELF_LOGGER_LEVEL Minimum log level (debug, info, notice, warning, error, critical, alert, emergency) warning
GELF_LOGGER_TAGS Comma-separated extra tags for Graylog stream filtering (empty)

Publishing Configuration

To customize processors or other advanced settings, publish the config file:

This creates config/gelf-logger.php where you can modify the processor list and other options.

Laravel Logging Configuration

The package automatically registers the gelf channel. You can add it to your logging stack in config/logging.php:

Or use it as the default log channel:

Usage

Basic Logging

Use the gelf channel to send logs to Graylog:

Exception Logging

When logging exceptions, pass the exception in the context array with the key exception:

The formatter will automatically extract and flatten exception data into GELF additional fields:

Log Context & the extras Field

All custom context data you pass to a log call is grouped into a single extras JSON field in Graylog (rather than scattered as individual top-level fields). This keeps Graylog fields clean and makes Grafana dashboard building easier across multiple apps.

In Graylog, this appears as:

Exception data (exception_* fields) is not included in extras — it stays as individual top-level fields for easy searching.

Laravel Context Integration

Data added via Laravel's Context facade is automatically included in the extras field alongside your custom context. This is useful for request tracing across logs.

Now every log entry in that request will include the data in extras:

This allows you to correlate all log entries from a single request by searching for the value in Graylog.

Tags

Tags are used by Graylog for stream routing — stream rules can require specific tags to be present for a log to be routed to a particular stream.

The glfapp tag is always included automatically. This tag is required by Graylog stream rules to identify logs coming from Laravel applications using this package.

You can add extra per-app tags via the GELF_LOGGER_TAGS environment variable:

This is useful when multiple applications send logs to the same Graylog server — you can filter by app within a stream.

Processors

The package includes several Monolog processors by default:

Processor Description
GitProcessor Adds current Git branch and commit hash
MemoryUsageProcessor Adds current memory usage
MemoryPeakUsageProcessor Adds peak memory usage
LoadAverageProcessor Adds system load average
WebProcessor Adds HTTP request data (URL, method, IP, referrer)
TagProcessor Adds tags (glfapp + your custom tags)

Customizing Processors

After publishing the config file, you can modify the processor list:

Note: You don't need to add TagProcessor to the processors list — it is always included automatically with glfapp and any tags from GELF_LOGGER_TAGS.

GELF Message Structure

Each log message sent to Graylog includes:

Core Fields

Field Description
short_message The log message
host System name (from Monolog)
level Syslog priority level (0-7)
timestamp Log timestamp
facility The log channel name
service Application name (from config('app.name'))
hostname Server hostname (from gethostname())
log_status Human-readable log level name

Processor Fields (individual top-level fields)

Field Source
tags TagProcessor — always includes glfapp
git_branch, git_commit GitProcessor
memory_usage, memory_peak_usage MemoryUsageProcessor, MemoryPeakUsageProcessor
load_average LoadAverageProcessor
url, ip, http_method, server, referrer WebProcessor

Exception Fields (individual top-level fields)

Field Description
exception_class Exception class name
exception_message Exception message
exception_code Exception code
exception_file File and line where the exception occurred
exception_trace Full stack trace

Extras Field (single JSON field)

Field Description
extras JSON string containing all user-passed context data and Laravel Context::add() data

The extras field groups all custom data into one place, keeping Graylog fields clean and Grafana dashboards consistent across multiple applications.

Log Level Mapping

Monolog levels are mapped to GELF/syslog priorities:

Monolog Level GELF Priority Syslog Equivalent
Emergency 0 Emergency
Alert 1 Alert
Critical 2 Critical
Error 3 Error
Warning 4 Warning
Notice 5 Notice
Info 6 Informational
Debug 7 Debug

Graylog Setup

To receive logs from this package, your Graylog server needs a GELF input configured:

  1. Go to System → Inputs in the Graylog web interface
  2. Select GELF UDP (or GELF TCP if using TCP transport) from the dropdown
  3. Click Launch new input
  4. Set the port to 12201 (or your configured port)
  5. Save and start the input

Ensure the port is accessible from your Laravel application server.

Testing

Test your Graylog integration using the included Artisan command:

This command sends a test exception to the configured GELF server and confirms success.

Development

Code Style

Format code with Laravel Pint:

Static Analysis

Run PHPStan for static analysis:

License

This package is open-sourced software licensed under the MIT license.

Credits

Support

If you discover any issues, please open an issue on the GitHub repository.


All versions of laravel-gelf-logger with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
graylog2/gelf-php Version ^2.0
monolog/monolog Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package shadowbane/laravel-gelf-logger contains the following files

Loading the files please wait ...