minhyung/laravel-openobserve

Laravel package for OpenObserve integration - centralized log management and monitoring

Maintainers

Package info

github.com/overworks/laravel-openobserve

pkg:composer/minhyung/laravel-openobserve

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

0.1.0 2026-05-28 08:12 UTC

This package is auto-updated.

Last update: 2026-05-28 08:19:19 UTC


README

Tests Latest Version on Packagist Total Downloads

Laravel adapter for minhyung/openobserve, the PHP client for OpenObserve.

This package provides:

  • A configured Minhyung\OpenObserve\Client instance bound in the container
  • A custom Laravel log channel driver that ships logs through OpenObserve's Monolog handler
  • An openobserve:test Artisan command for connection checks

한국어 문서

Requirements

  • PHP 8.3+
  • Laravel 11.x or 12.x

Installation

composer require minhyung/laravel-openobserve

Publish the configuration file:

php artisan vendor:publish --tag=openobserve-config

Configuration

Add OpenObserve connection details to your .env file:

OPENOBSERVE_URL=http://localhost:5080
OPENOBSERVE_ORGANIZATION=default
OPENOBSERVE_STREAM=laravel-logs
OPENOBSERVE_EMAIL=your-email@example.com
OPENOBSERVE_PASSWORD=your-password

Configuration Options

Option Env Variable Default
url OPENOBSERVE_URL http://localhost:5080
organization OPENOBSERVE_ORGANIZATION default
stream OPENOBSERVE_STREAM default
auth.email OPENOBSERVE_EMAIL -
auth.password OPENOBSERVE_PASSWORD -
timeout OPENOBSERVE_TIMEOUT 5
ssl_verify OPENOBSERVE_SSL_VERIFY true

timeout and ssl_verify are applied to the Guzzle HTTP client that the service provider builds and injects into the OpenObserve client.

Laravel Logging Channel Setup

Add the OpenObserve channel to your config/logging.php:

'channels' => [
    // ... existing channels

    'openobserve' => [
        'driver' => 'custom',
        'via' => \Minhyung\LaravelOpenObserve\Logging\OpenObserveLogger::class,
        'level' => env('LOG_LEVEL', 'debug'),
        'name' => 'openobserve',
    ],

    // Optionally include openobserve in a stack channel
    'stack' => [
        'driver' => 'stack',
        'channels' => ['single', 'openobserve'],
        'ignore_exceptions' => false,
    ],
],

Set the default log channel in your .env file:

LOG_CHANNEL=stack  # or 'openobserve'

Usage

Laravel Logging

Use it just like standard Laravel logging:

use Illuminate\Support\Facades\Log;

Log::info('User logged in', ['user_id' => 123]);
Log::error('An error occurred', ['error' => $exception->getMessage()]);

Direct Client Access

The container resolves a configured Minhyung\OpenObserve\Client. Use the Facade or dependency injection to access it.

use Minhyung\LaravelOpenObserve\Facades\OpenObserve;

OpenObserve::logs()->json('laravel-logs', [
    ['level' => 'info', 'message' => 'User action', 'user_id' => 123],
]);
use Minhyung\OpenObserve\Client;

class SomeController extends Controller
{
    public function __construct(private Client $openObserve)
    {
    }

    public function index()
    {
        $this->openObserve->logs()->json('laravel-logs', [
            ['level' => 'info', 'message' => 'Controller executed'],
        ]);
    }
}

See minhyung/openobserve for the full client API (search, streams, alerts, dashboards, OTLP, etc.).

Connection Test

php artisan openobserve:test

Testing

composer test

Security Vulnerabilities

If you discover a security vulnerability, please email urlinee@gmail.com.

License

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

Credits