laravel-log-central maintained by khairulimran
Description
Ship logs and exceptions from a Laravel app to a Log Central server.
Author
Last update
2026/07/12 11:40
(dev-main)
License
Downloads
0
Tags
Laravel Log Central
Ship logs and exceptions from any Laravel app to your self-hosted Log Central server — zero code changes, three env values.
- Exceptions, automatically — every reported exception (web, queue, artisan, scheduler,
report($e)) is captured and shipped with fingerprint, stack trace, request info, and the authenticated user. - Log channels, wrapped — pick channels (or
*for all) and their entries stream to the central log viewer while local files keep working as backup. - Never blocks your app — everything ships through queued jobs, batched, with capped retries. Shipping failures are silent and can never loop.
- Scrubbed before sending — passwords, tokens, keys, and card numbers are replaced with
[scrubbed]before leaving the app.
Requirements
- PHP 8.2+, Laravel 11–13
- A running queue worker (Redis/Horizon recommended)
- A Log Central server and a project key (Apps page)
Installation
composer require khairulimran/laravel-log-central
Add to .env:
CENTRAL_LOG_URL=https://logs.example.com/api
CENTRAL_LOG_TOKEN=your-project-key
CENTRAL_LOG_APP=your-app-slug
# comma-separated list, or * to ship every channel
CENTRAL_LOG_CHANNELS=payment_callback,webhook
That's it. The service provider auto-registers, hooks exception reporting, and wraps the listed channels.
Configuration
Publish the config to customise scrub keys, the shipping queue, or defaults:
php artisan vendor:publish --tag=log-central-config
| Env | Default | Purpose |
|---|---|---|
CENTRAL_LOG_URL |
— | Base API URL of the Log Central server |
CENTRAL_LOG_TOKEN |
— | The app's project key |
CENTRAL_LOG_APP |
slug of app.name |
Must match the slug registered on Log Central |
CENTRAL_LOG_CHANNELS |
(empty) | Channels to ship; * = all (exceptions ship regardless) |
CENTRAL_LOG_QUEUE |
default queue | Queue name for shipping jobs |
CENTRAL_LOG_ENABLED |
true |
Master switch (set false in testing) |
What gets captured
| Situation | Shipped? |
|---|---|
| Uncaught exception (web, queue, artisan, scheduler) | ✅ as error |
report($e) inside try/catch |
✅ as error |
Log::...() on a shipped channel |
✅ as log entry |
Log::...() on an unlisted channel |
❌ file only |
Exception silently swallowed without report() |
❌ |
Testing
composer install
composer test
License
MIT