Giter VIP home page Giter VIP logo

terminus-site-debug's Introduction

Logs Parser

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

terminus-site-debug's People

Contributors

edwardangert avatar geraldvillorente avatar jfussion avatar jocastaneda avatar kporras07 avatar kyletaylored avatar namespacebrian avatar stovak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terminus-site-debug's Issues

T3 compatibility

This has the Actively Maintained but needs T3 compatibility work

Version bump to be compatible with Terminus 2.4.1

Getting errors like:

In ComposerDependencyValidator.php line 120:

The plugin geraldvillorente/terminus-site-debug has installed the project psr/log:
1.1.0, but Terminus has installed psr/log: 1.1.3. To resolve this, try running 'c
omposer update' in both the plugin directory, and the terminus directory.

The plugin geraldvillorente/terminus-site-debug has installed the project squizlab
s/php_codesniffer: 3.5.6, but Terminus has installed squizlabs/php_codesniffer: 3.
5.5. To resolve this, try running 'composer update' in both the plugin directory,
and the terminus directory.

Get logs not older than 7 days

Hi! Thanks for your wonderful plugin!
Is it possible to get logs not older than 7 days, for example, with this plugin?

[BUGS-5985] PHP 8.2 deprecation notices

PHP Deprecated:  Creation of dynamic property Pantheon\TerminusSiteLogs\Commands\PhpFpmErrorCommand::$logPath is deprecated in ~/.terminus/terminus-dependencies-2cb33384ed/vendor/pantheon-systems/terminus-site-debug/src/Commands/PhpFpmErrorCommand.php on line 38

Deprecated: Creation of dynamic property Pantheon\TerminusSiteLogs\Commands\PhpFpmErrorCommand::$logPath is deprecated in ~/.terminus/terminus-dependencies-2cb33384ed/vendor/pantheon-systems/terminus-site-debug/src/Commands/PhpFpmErrorCommand.php on line 38
PHP Deprecated:  Creation of dynamic property Pantheon\TerminusSiteLogs\Commands\SiteLogsCommand::$width is deprecated in ~/.terminus/terminus-dependencies-2cb33384ed/vendor/pantheon-systems/terminus-site-debug/src/Commands/SiteLogsCommand.php on line 43

Deprecated: Creation of dynamic property Pantheon\TerminusSiteLogs\Commands\SiteLogsCommand::$width is deprecated in ~/.terminus/terminus-dependencies-2cb33384ed/vendor/pantheon-systems/terminus-site-debug/src/Commands/SiteLogsCommand.php on line 43
PHP Deprecated:  Creation of dynamic property Pantheon\TerminusSiteLogs\Commands\SiteLogsCommand::$logPath is deprecated in ~/.terminus/terminus-dependencies-2cb33384ed/vendor/pantheon-systems/terminus-site-debug/src/Commands/SiteLogsCommand.php on line 44

Deprecated: Creation of dynamic property Pantheon\TerminusSiteLogs\Commands\SiteLogsCommand::$logPath is deprecated in ~/.terminus/terminus-dependencies-2cb33384ed/vendor/pantheon-systems/terminus-site-debug/src/Commands/SiteLogsCommand.php on line 44
PHP Deprecated:  Creation of dynamic property Pantheon\TerminusSiteLogs\Commands\MysqlSlowCommand::$logPath is deprecated in ~/.terminus/terminus-dependencies-2cb33384ed/vendor/pantheon-systems/terminus-site-debug/src/Commands/MysqlSlowCommand.php on line 38

Deprecated: Creation of dynamic property Pantheon\TerminusSiteLogs\Commands\MysqlSlowCommand::$logPath is deprecated in ~/.terminus/terminus-dependencies-2cb33384ed/vendor/pantheon-systems/terminus-site-debug/src/Commands/MysqlSlowCommand.php on line 38
PHP Deprecated:  Creation of dynamic property Pantheon\TerminusSiteLogs\Commands\PhpErrorCommand::$logPath is deprecated in ~/.terminus/terminus-dependencies-2cb33384ed/vendor/pantheon-systems/terminus-site-debug/src/Commands/PhpErrorCommand.php on line 38

Deprecated: Creation of dynamic property Pantheon\TerminusSiteLogs\Commands\PhpErrorCommand::$logPath is deprecated in ~/.terminus/terminus-dependencies-2cb33384ed/vendor/pantheon-systems/terminus-site-debug/src/Commands/PhpErrorCommand.php on line 38
PHP Deprecated:  Creation of dynamic property Pantheon\TerminusSiteLogs\Commands\NginxErrorCommand::$logPath is deprecated in ~/.terminus/terminus-dependencies-2cb33384ed/vendor/pantheon-systems/terminus-site-debug/src/Commands/NginxErrorCommand.php on line 38

Deprecated: Creation of dynamic property Pantheon\TerminusSiteLogs\Commands\NginxErrorCommand::$logPath is deprecated in ~/.terminus/terminus-dependencies-2cb33384ed/vendor/pantheon-systems/terminus-site-debug/src/Commands/NginxErrorCommand.php on line 38
PHP Deprecated:  Creation of dynamic property Pantheon\TerminusSiteLogs\Commands\PhpSlowCommand::$logPath is deprecated in ~/.terminus/terminus-dependencies-2cb33384ed/vendor/pantheon-systems/terminus-site-debug/src/Commands/PhpSlowCommand.php on line 38

Deprecated: Creation of dynamic property Pantheon\TerminusSiteLogs\Commands\PhpSlowCommand::$logPath is deprecated in ~/.terminus/terminus-dependencies-2cb33384ed/vendor/pantheon-systems/terminus-site-debug/src/Commands/PhpSlowCommand.php on line 38
Downloading Terminus (pantheon-systems/terminus) 3.1.4.0

Cannot install via Terminus plugin installer

Readme states it can be installed this way, but it doesn't work.

➜  ~ terminus self:plugin:install pantheon-systems/terminus-site-debug
 [error]  pantheon-systems/terminus-site-debug is not a valid Packagist project.
➜  ~ terminus --version
Terminus 3.0.6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.