zipzoft / laravel-log-channels
Laravel 日志通道
1.2.0
2022-03-23 05:02 UTC
Requires
- php: ^7.4|^8.0
- illuminate/support: ^7.0|^8.0|^9.0
Requires (Dev)
- orchestra/testbench: ~3.8.0|^4.0|^5.0|^6.0
- phpunit/phpunit: ^8.0|^9.0
This package is auto-updated.
Last update: 2024-09-23 10:54:05 UTC
README
为 Laravel 添加更多日志通道,适用于需要额外通道来记录日志的情况
我们目前拥有的通道
安装
composer require zipzoft/laravel-log-channels
不同通道
Elasticsearch
您必须先安装 elasticsearch 客户端
通过运行以下命令
php artisan zipzoft:logger-channel:install elasticsearch
或使用以下命令自行安装
composer require elasticsearch/elasticsearch
如果需要修改配置,您可以在 config/logging.php 中添加配置
'channels' => [ // ... 'elasticsearch' => [ 'driver' => 'custom', 'via' => Zipzoft\LogChannels\ElasticsearchDriver::class, 'index' => 'laravel_app_log', ], ],
AWS CloudWatch
此通道需要依赖项
{ "required" : { "aws/aws-sdk-php": "~3.0", "maxbanton/cwh": "^2.0" } }
使用以下命令安装
php artisan zipzoft:logger-channel:install cloudwatch
如果需要修改配置,您可以在 config/logging.php 中添加配置
'channels' => [ // ... 'cloudwatch' => [ 'driver' => 'custom', 'credentials' => [ 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), ], 'group_name' => env('CLOUDWATCH_LOG_GROUP_NAME'), 'name' => env('CLOUDWATCH_LOG_NAME'), 'region' => env('AWS_DEFAULT_REGION'), 'retention' => env('CLOUDWATCH_LOG_RETENTION_DAYS', 14), 'version' => env('CLOUDWATCH_LOG_VERSION', 'latest'), 'batch_size' => env('CLOUDWATCH_LOG_BATCH_SIZE', 10000), 'via' => Zipzoft\LogChannels\CloudwatchLogger::class, ]; ],