officegest / api-logger
Monitoring and log your APIs
1.2.3
2024-11-20 16:46 UTC
Requires
- php: ^8.1
- ext-json: *
- elasticsearch/elasticsearch: *
Requires (Dev)
- guzzlehttp/guzzle: ^7.7.0
- laravel/octane: ^1.5.6
- laravel/pint: ^1.10.3
- orchestra/testbench: ^7.0 || ^8.5.9
- phpstan/phpstan: ^1.10.25
README
This is a laravel package to save logs from api.
Installation
composer require officegest/api-logger
Publish the config file for this package. This will add the file config/officegest-api-logger-config.php
, where you
can configure this package.
$ php artisan vendor:publish --tag=officegest-api-logger-config
You need add this variables to your .env
API_LOGGER_ELASTIC_HOST=true
API_LOGGER_ELASTIC_LOGS_INDEX="your_officegest_url"
Usage
Add middleware alias to $middlewareAliases
//app/Http/Kernel.php (l10)
'logger' => \OfficegestApiLogger\Middlewares\OfficegestApiLoggerMiddleware::class,
Add middleware at routes you want log to elasticsearch
/*
|--------------------------------------------------------------------------
| Example add middleware to group of endpoints
|--------------------------------------------------------------------------
*/
Route::middleware('logger')->controller(YourController::class)
->name('yourname.')
->prefix('yourprefix')
->group(function () {
...
});
Security
If you discover any security related issues, please email suporte@guisoft.net or use issues of this repo.