yexk / laravel-loki-logger
Laravel package for logging with Loki
v1.0.0
2021-09-22 07:20 UTC
Requires
- php: ^7.0|^8.0
- ext-json: *
- illuminate/console: ^8.0.0
- illuminate/support: ^8.0.0
- monolog/monolog: ^2.0.0
README
Laravel package for logging with Loki
Forked from https://github.com/devcake-deventer/laravel-loki-logging
Usage
- Install this package:
composer require yexk/laravel-loki-logger
- Publish the configuration: `php artisan vendor:publish --tag=laravel-loki-logger
- Create a new log channel in
config/logging.php
:'loki' => [ 'driver' => 'monolog', 'handler' => LokiLogger::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.