typhonius/acquia-logstream
Composer 安装命令:
composer require typhonius/acquia-logstream
包简介
PHP library to connect to Acquia Logstream service
README 文档
README
Acquia Logstream
Pre-installation
- Run
composer install
Generating an API access token
To generate an API access token, login to https://cloud.acquia.com, then visit https://cloud.acquia.com/#/profile/tokens, and click Create Token.
-
Provide a label for the access token, so it can be easily identified. Click Create Token.
-
Once the token has been generated, copy the api key and api secret to a secure place. Make sure you record it now: you will not be able to retrieve this access token's secret again.
Usage
Standalone tools
Phar file
A Phar file will be attached to each tagged release on GitHub. This can be downloaded and used immediately with php logstream.phar acquia:logstream
Shell script
A shell script has been included as a wrapper for the logstream command which will allow users to run the logstream command directly without further requirements. This can be invoked by running ./bin/logstream acquia:logstream from the cloned directory.
PHP Library
The LogstreamManager class can be included in any other PHP library as it has been within the Acquia Cli tool. The simplest method of including and calling this library is as follows:
use AcquiaCloudApi\Connector\Client;
use AcquiaCloudApi\Connector\Connector;
use AcquiaCloudApi\Endpoints\Logs;
use AcquiaLogstream\LogstreamManager;
$config = [
'key' => 'FILL ME',
'secret' => 'FILL ME'
];
$environmentUuid = 'FILL ME'
$connector = new Connector($config);
$client = Client::factory($connector);
$logs = new Logs($client);
$stream = $logs->stream($environmentUuid);
$params = $stream->logstream->params;
$logstream = new LogstreamManager($input, $output, $params);
$logstream->stream();
More advanced usage allows for different options to be set and configured through methods on the LogstreamManager class.
Command Parameters
The Logstream command takes three required arguments as parameters.
- Your Acquia API key
- Your Acquia API secret
- The environment UUID
There are also three optional parameters which can be used to filter log types, servers to stream logs from, and to enable colourisation.
Examples
# Show help
./bin/logstream acquia:logstream --help
# Stream all logs from all servers
./bin/logstream acquia:logstream APIKEY APISECRET ENVIRONMENTUUID
# Stream Varnish and NGINX logs
./bin/logstream acquia:logstream APIKEY APISECRET ENVIRONMENTUUID -t bal-request -t varnish-request
# Stream PHP error and Apache error logs from one server
./bin/logstream acquia:logstream APIKEY APISECRET ENVIRONMENTUUID -t php-error -t apache-error -s web-1234
# Stream all logs with colourisation to determine which log type is used
./bin/logstream acquia:logstream APIKEY APISECRET ENVIRONMENTUUID -c
typhonius/acquia-logstream 适用场景与选型建议
typhonius/acquia-logstream 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 339.65k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2019 年 12 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 typhonius/acquia-logstream 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 typhonius/acquia-logstream 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 339.65k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 21
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-12-26