devcake-deventer / laravel-loki-logging
Logging to Loki for Laravel
Installs: 2 085
Dependents: 0
Suggesters: 0
Security: 0
Stars: 13
Watchers: 4
Forks: 11
Open Issues: 1
Requires
- php: ^7.0
- ext-json: *
- illuminate/console: ^7.0.0
- illuminate/support: ^7.0.0
- monolog/monolog: ^2.0.0
This package is auto-updated.
Last update: 2024-10-26 20:32:35 UTC
README
Logging to Loki for Laravel
Usage
- Install this package:
composer require devcake-deventer/laravel-loki-logging
- Publish the configuration:
php artisan vendor:publish --provider=Devcake\\LaravelLokiLogging\\L3ServiceProvider
- Create a new log channel in
config/logging.php
:'loki' => [ 'driver' => 'monolog', 'handler' => L3Logger::class, ]
- Configure at least the
LOG_CHANNEL
,LOG_USERNAME
andLOG_PASSWORD
- Ensure
APP_NAME
is configured appropriately. If this value cannot be changed, useLOG_APP
. - Optionally configure
LOG_SERVER
andLOG_FORMAT
- Ensure
- Configure the
loki:persist
job to run periodically in your schedule. We recommend every minute, but feel free to reduce this. Log::info('Hello Loki!');
Configuration
The behaviour of the logger can be adjusted with the config options below.