felixmaier1989/maxbanton-cwh
Composer 安装命令:
composer require felixmaier1989/maxbanton-cwh
包简介
AWS CloudWatch Handler for Monolog library
关键字:
README 文档
README
Handler for PHP logging library Monolog for sending log entries to AWS CloudWatch Logs service.
Before using this library, it's recommended to get acquainted with the pricing for AWS CloudWatch services.
Please press ★ Star button if you find this library useful, aslo you can donate if you like to.
Features
- Up to 10000 batch logs sending in order to avoid Rate exceeded errors
- Log Groups creating with tags
- AWS CloudWatch Logs staff lazy loading
- Suitable for web applications and for long-living CLI daemons and workers
- Compatible with PHP 5.6 / 7.0 / 7.1
Installation
Install the latest version with Composer
$ composer require maxbanton/cwh:^1.0
Upgrade
Change in your composer.json
{
"require": {
"maxbanton/cwh": "^0.0.3"
}
}
to
{
"require": {
"maxbanton/cwh": "^1.0"
}
}
then run
$ composer update
and change your code
<?php // Instantiate handler $handler = new CloudWatch($client, $logGroupName, $logStreamName, $daysToRetention);
to
<?php // Instantiate handler (tags are optional) $handler = new CloudWatch($client, $groupName, $streamName, $retentionDays, 10000, ['my-awesome-tag' => 'tag-value']);
Basic Usage
<?php use Aws\CloudWatchLogs\CloudWatchLogsClient; use Maxbanton\Cwh\Handler\CloudWatch; use Monolog\Logger; $sdkParams = [ 'region' => 'eu-west-1', 'version' => 'latest', 'credentials' => [ 'key' => 'your AWS key', 'secret' => 'your AWS secret', 'token' => 'your AWS session token', // token is optional ] ]; // Instantiate AWS SDK CloudWatch Logs Client $client = new CloudWatchLogsClient($sdkParams); // Log group name, will be created if none $groupName = 'php-logtest'; // Log stream name, will be created if none $streamName = 'ec2-instance-1'; // Days to keep logs, 14 by default $retentionDays = 30; // Instantiate handler (tags are optional) $handler = new CloudWatch($client, $groupName, $streamName, $retentionDays, 10000, ['my-awesome-tag' => 'tag-value']); // Create a log channel $log = new Logger('name'); // Set handler $log->pushHandler($handler); // Add records to the log $log->debug('Foo'); $log->warning('Bar'); $log->error('Baz');
Frameworks integration
Issues
Feel free to report any issues
Contributing
Please check this document
Donate
If you would like to, you can send any amount of BTC to the wallet 12d3VXfvPiQ5bFMfPppGqpwnNSkZwigBVt
felixmaier1989/maxbanton-cwh 适用场景与选型建议
felixmaier1989/maxbanton-cwh 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 10 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「monolog」 「aws」 「cloudwatch」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 felixmaier1989/maxbanton-cwh 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 felixmaier1989/maxbanton-cwh 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 felixmaier1989/maxbanton-cwh 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A GeoIP decorator/processor for monolog
This package includes a script and fail2ban configuration that allows you to use fail2ban when utilizing AWS elastic load balancer (ELB) and an apache webserver.
Elastic Driver for Laravel Scout
Log events to AWS CloudWatch including embedded metrics
A Zend Framework module that sets up Monolog for logging in applications.
Laravel 5.6 Monolog custom telegram channel
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-10-17