承接 pantheon-systems/terminus-site-debug 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pantheon-systems/terminus-site-debug

Composer 安装命令:

composer require pantheon-systems/terminus-site-debug

包简介

Get server logs on all appservers in a specific environment.

README 文档

README

Actively Maintained

Terminus v1.x Compatible

A Terminus plugin that:

  • download site logs from a specific environment of a Pantheon sites
  • parse the logs for debugging purposes

This will also pull logs on an environment with multiple containers.

Learn more about Terminus and Terminus Plugins at: https://pantheon.io/docs/terminus/plugins/

Examples

Download all logs from dev.

terminus logs:get <site>.<env>

Only download nginx-access.log and nginx-error.log logs.

terminus logs:get <site>.<env> --nginx-access --nginx-error

Exclude nginx-access.log and nginx-error.log from download.

terminus logs:get <site>.<env> --exclude --nginx-access --nginx-error

Parsing Nginx Access Logs

Search nginx-access logs with 301 status code via PHP.

terminus logs:parse:nginx-access <site>.<env> --filter="301" --php

Show how many times the IP visited the site.

terminus logs:parse:nginx-access <site>.<env> --grouped-by=ip

Top response by HTTP status.

terminus logs:parse:nginx-access <site>.<env> --grouped-by=response-code

Top 403 requests

terminus logs:parse:nginx-access <site>.<env> --grouped-by=403

Top 404 requests

terminus logs:parse:nginx-access <site>.<env> --grouped-by=404

Top PHP 404 requests.

terminus logs:parse:nginx-access <site>.<env> --grouped-by=php-404

Top PHP 404 requests in full details.

terminus logs:parse:nginx-access <site>.<env> --grouped-by=php-404-detailed

Top 502 requests

terminus logs:parse:nginx-access <site>.<env> --grouped-by=502

Top IPs accessing 502.

To get 502 URIs run this command first: terminus logs:parse:nginx-access site_name.env --grouped-by=502

terminus logs:parse:nginx-access <site>.<env> --grouped-by=ip-accessing-502 --uri={SITE_URI}

Count the request that hits the appserver per second.

terminus logs:parse:nginx-access <site>.<env> --grouped-by=request-per-second

Top request methods.

terminus logs:parse:nginx-access <site>.<env> --grouped-by=request-method --code=[200|403|404|502]

Parsing Nginx Error Logs

Search nginx-error.log for access forbidden error.

terminus logs:parse:nginx-error <site>.<env> --grouped-by="access forbidden" 

Search nginx-error.log for SSL_shutdown error.

terminus logs:parse:nginx-error <site>.<env> --grouped-by="SSL_shutdown" 

Search nginx-error.log for "worker_connections" error.

This error means that the site has no enough PHP workers. Consider upgrading to a higher plan to add more appservers.

terminus logs:parse:nginx-error <site>.<env> --grouped-by="worker_connections" 

To get the latest entries.

You can adjust the results by passing a numeric value to --filter which has a default value of 10.

terminus logs:parse:nginx-error <site>.<env>

Parsing PHP Error Logs

Search for the latest entries.

terminus logs:parse:php-error <site>.<env> --grouped-by=latest

Search php-error logs with 301 "Uncaught PHP Exception" error.

terminus logs:parse <site>.<env> --type=php-error --filter="Uncaught PHP Exception" --php

Search to all the logs.

terminus logs:parse <site>.<env> --type=all --filter="error" --php

Parsing PHP Slow Logs

Search for the latest entries.

terminus logs:parse:php-slow <site>.<env> --grouped-by=latest 

Top functions by number of times they called.

terminus logs:parse:php-slow <site>.<env> --grouped-by=function

Slow requests grouped by minute

terminus logs:parse:php-slow <site>.<env> --grouped-by=minute

Parsing MySQL Slow Log

Display everything.

terminus logs:parse:mysql-slow <site>.<env> 

Count of queries based on their time of execution.

terminus logs:parse:mysql-slow <site>.<env> --grouped-by=time

Display only the first N queries in the output. Sort output by count i.e. number of times query found in mysqld-slow-query.log.

This queries might be a good option for caching the result.

terminus logs:parse:mysql-slow <site>.<env> --grouped-by=query-count 

Display only the first N queries in the output.

Top queries which returned maximum rows.

terminus logs:parse:mysql-slow <site>.<env> --grouped-by=average-rows-sent

Logs listing

To list all the log files.

terminus logs:list <site>.<env>

Support

This plugin is not working on Windows environment. You may want to Dockerized your Terminus to use this kind of plugin that uses nix commands to parse the logs.

Installation

For help installing, see Manage Plugins

mkdir -p ~/.terminus/plugins
cd ~/.terminus/plugins
git clone https://github.com/pantheon-systems/terminus-site-debug.git

To install this in Terminus 3, run this command:

terminus self:plugin:install pantheon-systems/terminus-site-debug

Credits

pantheon-systems/terminus-site-debug 适用场景与选型建议

pantheon-systems/terminus-site-debug 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.91k 次下载、GitHub Stars 达 17, 最近一次更新时间为 2022 年 04 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 pantheon-systems/terminus-site-debug 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 pantheon-systems/terminus-site-debug 我们能提供哪些服务?
定制开发 / 二次开发

基于 pantheon-systems/terminus-site-debug 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 5.91k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 17
  • 点击次数: 13
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 17
  • Watchers: 8
  • Forks: 13
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-04-27