nnaemekanweke / logwatch
Push your Laravel app's logs to LogWatch as a standard log channel.
v1.0.0
2026-09-29 01:01 UTC
Requires
- php: ^8.2
- illuminate/contracts: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
- monolog/monolog: ^3.0
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0|^11.0
- phpunit/phpunit: ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Push your Laravel app's logs to LogWatch as a standard
Laravel log channel — no new logging API to learn, just Log::info(...) like
always.
Installation
composer require nnaemekanweke/logwatch php artisan vendor:publish --tag=logwatch-config
Add to .env:
LOGWATCH_API_KEY=your-tenant-api-key LOGWATCH_ENDPOINT=https://your-logwatch-instance.example.com LOGWATCH_LOG_GROUP="${APP_NAME}" LOGWATCH_LOG_STREAM="${APP_ENV}"
Get LOGWATCH_API_KEY from your LogWatch dashboard under Settings > Tenant
API Key — it's shared across your whole tenant, not tied to one user.
Usage
Register the channel in config/logging.php:
'channels' => [ // ... 'logwatch' => [ 'driver' => 'custom', 'via' => \Nnaemekanweke\Logwatch\Logging\LogWatchChannelFactory::class, ], ],
Then either log straight to it:
Log::channel('logwatch')->info('Order shipped', ['order_id' => $order->id]);
or add it to your stack channel so every log line goes to LogWatch
alongside your normal log file:
'stack' => [ 'driver' => 'stack', 'channels' => ['single', 'logwatch'], ],
LOG_STACK=stack
How it works
- Log groups and streams are created automatically on first push (like
CloudWatch's
PutLogEvents) — nothing to provision up front. - Records are buffered in memory and flushed as a single batched API call at the end of the request or command, instead of one HTTP call per log line.
- Delivery failures (network errors, LogWatch downtime) are caught and swallowed — a broken connection to LogWatch will never break your app or throw from a log call.
Configuration reference
| Env var | Default | Description |
|---|---|---|
LOGWATCH_API_KEY |
— | Required. Your tenant's API key. |
LOGWATCH_ENDPOINT |
http://localhost:8000 |
Base URL of your LogWatch instance. |
LOGWATCH_LOG_GROUP |
APP_NAME |
Log group name (auto-created). |
LOGWATCH_LOG_STREAM |
APP_ENV |
Log stream name (auto-created). |
LOGWATCH_BUFFER_SIZE |
50 |
Records buffered before an early flush. |
LOGWATCH_TIMEOUT |
5 |
HTTP timeout in seconds. |
Testing
composer install vendor/bin/phpunit