richpeers / laravel-log-oauth2-curl
Queue Laravel Logs send via curl and auth via OAuth2 Client Credentials Grant Token
Requires
- php: ^7.1.3
- guzzlehttp/guzzle: ~6.0
- laravel/framework: ~5.6.0|~5.7.0
- monolog/monolog: ~1.12
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-10-29 05:22:48 UTC
README
Custom Log driver for Laravel 5.6 || 5.7
Queued and posted via cURL, authorised with (cached) Client Credentials Grant Token.
This package is intended as a client to a server, for recording logs. Useful where you have multiple projects and might have one or more instances. For example develop, test or staging.
Server requirement
Two endpoints are required at your log server. These are defaults and can be changed in config.
/oauth/token
Passport's default route for granting token response to client_id and client_secret./api/logger
POST the logs.
Installation
Install with composer. The package will automatically register itself.
composer require richpeers/laravel-log-oauth2-curl
Add environment specific variables. Get the client_id and client_secret credentials from your log server.
LOG_SERVER_HOST=https://your-server.base-url.com
LOG_SERVER_CLIENT_ID=
LOG_SERVER_CLIENT_SECRET=
Add the following to the channels array in your /config/logging.php file.
'logserver' => ['driver' => 'logserver']
Set default log channel in .env ( Or add channel to stack array in /config/logging.php )
LOG_CHANNEL=logserver
Optionally run this command to copy logserver.php to /config, to modify it.
php artisan vendor:publish --tag=logserver
Queue Driver
As the package queues the logs before being authenticated and posted to the log server, using something like redis as your queue driver will mean a faster response for the user if there is an error.